Risposto
Excel and MATLAB connection
You can use xlsread to read data from Excel in your code. I would avoid the use of ActiveX whenever you can avoid it. You can fi...

oltre 7 anni fa | 1

Risposto
Average of a single element in an array
The best method depends on how you have generated your array. I will show two examples below. %example 1: only integers A=rand...

oltre 7 anni fa | 1

| accettato

Risposto
How can I rotate the lines on an image
You can use code similar to that below. I changed the step size to 30 degrees to make it more clear what is happening. clc cen...

oltre 7 anni fa | 0

| accettato

Risposto
how to sum of each row according to values values in given function
You can do something like the code below. You could use a for loop instead of the call to cellfun, but as you can see, you don't...

oltre 7 anni fa | 2

| accettato

Risposto
how to estimate bright channel for color image in Matlab??
Below you find 2.5 strategies. The first should be a lot faster, especially for larger images. With the last it is easier to see...

oltre 7 anni fa | 0

Risposto
Please advise me on how to improve the efficiency of this code?
You could use an explicit dialog box to avoid any confusion: answer = questdlg(... 'Do you want to try again?', ...%questi...

oltre 7 anni fa | 0

| accettato

Risposto
Working with dicom images
You need to convert to either a double or a int16 (before applying the subtraction). The latter only has a maximum half as high ...

oltre 7 anni fa | 0

| accettato

Risposto
Using a While loop to determine number greater than a constant
I'm a bit hesitant to provide you with a complete working solution, since you mention it is homework. I will give you some advic...

oltre 7 anni fa | 0

Risposto
Why reading in csv files will not work for me.
Why aren't you trying something like this? files = dir('*.csv') Q = numel(files); data=cell(Q,1); for n=1:Q % Read in C...

oltre 7 anni fa | 0

Risposto
distributing two values in 3d array
You could also do the following: L=60; % Number of columns b=25; % Number of rows w=25; %the depth of the 3D lattice K_f1=5e...

oltre 7 anni fa | 1

Risposto
make cell and put number on it
You can do it like this: n=20; result=num2cell(1:n);

oltre 7 anni fa | 0

| accettato

Risposto
reducing resolution of an image
You can use the imresize function to resample images: A=uint8(randi(255,1666,1200,3));%generate random 2MP image dims=size(A);...

oltre 7 anni fa | 0

| accettato

Risposto
Title a plot with variable 'char'
Your function declaration must match the use, so you need to put this line at the top of your function instead: function [figur...

oltre 7 anni fa | 0

| accettato

Risposto
Update my plot each time parameters change
You should set the callback function of your slider to update the plot. If you need more specific help, attach your code (and fi...

oltre 7 anni fa | 0

| accettato

Risposto
How to optimize this equation:Collection/ward ( Y) = 1.55495763465296E-06-1.57475099626936E-09*C1+ 1.23047294575684E-10*C3+ 1499.99999957807*C4
This is something you could solve algebraically: C4=(1.55495763465296E-06-1.57475099626936E-09*C1+ 1.23047294575684E-10*C3-y)/(...

oltre 7 anni fa | 2

Risposto
How do I find the maximum and minimum value(s) of my randomly generated bar chart, and set a specific color for the max and min value(s)?
The code below puts 2 extra bar plots with the desired colors. It also avoids loops. %n_throws=input("choose a number of throws...

oltre 7 anni fa | 0

| accettato

Risposto
Is it possible to store jpg images in an array to use in a function?
To give an example of how you could do it with a cell array: images=cell(2,10); ratios=zeros(1,size(images,2)); for n=1:size(...

oltre 7 anni fa | 1

Risposto
code for conditional statement
You can use code similar to that below. It is easier to put the input data in a cell arrray than to have different names for the...

oltre 7 anni fa | 0

| accettato

Risposto
can not plot the graph and there is samething wrong on my script, can anyone checkit
Your code doesn't do what you think it does. You could see that by looking at your variables: they have become scalars, instead ...

oltre 7 anni fa | 1

Risposto
"set" VS "=" assignment
The set syntax is older than the object notation. The advantages of the set syntax are that you can use it in older Matlab rele...

oltre 7 anni fa | 1

| accettato

Risposto
Calculate the Area Between Two Curves
This code should help. It assumes you want to count all the area between the two lines as positive. The more crossings there are...

oltre 7 anni fa | 1

Risposto
Display Value in Text Box
You need to transform your value to text using either sprintf or num2str: a=trapz(cP6-cP7); str=sprintf('Area Swept: %d',a);...

oltre 7 anni fa | 1

| accettato

Risposto
How do I verify user input from prompt/inputdlg and go back to same prompt if input is invalid?
One of the ways to solve this is with a recursive function. (another solution you could choose is a while loop) function matrix...

oltre 7 anni fa | 0

| accettato

Risposto
How to use waitbar while copying images from folders and subfolders
What I would do is first make a list of all sources and targets, and then do the actual copying in a loop like this h_wait=wait...

oltre 7 anni fa | 0

| accettato

Risposto
Link to MATLAB documentation
If you type this doc prob.normaldistribution.random at least you will get to the correct doc page. You'll have to scroll (or u...

oltre 7 anni fa | 0

| accettato

Risposto
How to detect first 50 white pixels from right side of a binary image?
You can use find to get the indices from the left, so the only thing you need to do is flipping the image and convert the col in...

oltre 7 anni fa | 0

| accettato

Risposto
Display figure returned by .m function into GUI axis
(This is an earlier comment reposted as answer. I would suggest giving Jan's answer an upvote if you think he helped to get to a...

oltre 7 anni fa | 0

| accettato

Risposto
Facing a problem in calculating the sum of digits of 100!.
This is due to how computers store digits. You will need to rethink your method for big numbers: clc %don't use clear, use fun...

oltre 7 anni fa | 0

Risposto
Exclude one row from calculation
The easiest way to do this is with a logical vector: Reference=2; ABC=[1;2;3;4;5;6]; L=ABC~=Reference; logodds(1:5,:)=log(AB...

oltre 7 anni fa | 0

| accettato

Risposto
Area between two curves that intersect
You are using the loop incorrectly, and you don't need it anyway. You are doing an integration over a single point, which is unl...

oltre 7 anni fa | 2

| accettato

Carica altro