Answered
finding the mean and max
The first column you can achieve with unique, the second and third can be done with accumarray. x=[ 1 1 1 2 2 1 1 3 1 ; 2 3 2 4...

8 years ago | 0

| accepted

Answered
I am getting the following error:
The real fix is to prevent a function to add the system32 folder in the first place, but the code below is the temporary fix to ...

8 years ago | 3

Answered
What does guidata do?
It actually works as you described it Guidata stores a struct to your GUI, or loads a saved struct. If you make changes you nee...

8 years ago | 1

| accepted

Answered
bar() to a specific axes in GUI
You should always use explicit handles. You could indeed use the code you describe (which you would then need to put just before...

8 years ago | 1

| accepted

Answered
How do I fit a nonlinear function correctly in matlab
I don't have the toolbox that contains the fitnlm so I'm using fminsearch instead: data=[... 0.0037071 0.5 0.015203 ...

8 years ago | 3

Answered
How to replace zero elements with the mean of the closest previous and following values?
The code below doesn't average the non-zero above and below for each row, but gets the closest non-zero, with a bias towards the...

8 years ago | 1

| accepted

Answered
How do I compute RMSE for Color Image ??
If the function you are using is from this FEX submission, then yes, it will work. The interpretation of the RMSE might be more ...

8 years ago | 0

| accepted

Answered
can anyone please provide me the source code for SPIHT algorithm
If I search the web for SPIHT Matlab this FEX submission is my first hit: link

8 years ago | 0

| accepted

Answered
Hatched fill pattern using colormap
applyhatch_pluscolor from the FEX should do this. Despite the lack of recent updates, judging by the comments it should still wo...

8 years ago | 1

Answered
How do I fix this
You are using t as an index to m_t, but that contains negative values. (in the call to trapz) I suspect you want to run the lin...

8 years ago | 0

| accepted

Answered
[DISCONTINUED] MATLAB Answers Wish-list #4 (and bug reports)
If a question is closed, you cannot write a comment anymore. E.g. this question was already closed, but since it was the first q...

8 years ago | 0

Answered
I have a code but it keep saying "invalid expression. when calling a function or indexing a variable, use parentheses. otherwise check for mismatched delimiters.
You are using square brackets for the sin function, instead of parentheses. Also, you were missing a lot of * signs. You should ...

8 years ago | 3

Answered
[DISCONTINUED] MATLAB Answers Wish-list #4 (and bug reports)
Since the new editor has become way more fancy: A while back I read in some help page for the Answers forum that a referrence t...

8 years ago | 2

Answered
Converting the program to the GUI version
There are many ways to share data between callbacks. In the context of GUIs the most often used function is guidata. You can al...

8 years ago | 1

Answered
Hi there, I need to create a code that can replace the diagonal values on a matrix with 0's..
A=rand(5,5); A(size(A,2):(size(A,2)-1):(numel(A)-1))=0

8 years ago | 2

Answered
Using xlsread in a for loop
If the worksheet names are 0.600 etc you can use the code below. B=struct; for n=20:-1:1 A= xlsread(filename,spri...

8 years ago | 1

Answered
How to calculate 3D Positions using the distance from 3 separate points in space?
You could use something like the code below. It uses only base Matlab functions to search a position where the radii of your mea...

8 years ago | 0

| accepted

Answered
it says it has an untitled error in line 6 which i think it's about clause of if
You made the mistake of using |i| and |j| as variables and you forgot to initialize |j|. Also, think about what this code doe...

8 years ago | 0

| accepted

Answered
How can I calculate the area between two curves?
The |polyarea| function handles this just fine. figure(1),clf(1) x=0:1500; y1=@(x)(100./0.93).*(((x./19).^(10))./(1+(...

8 years ago | 0

| accepted

Answered
is it possible to write a code that experiments with zero mean Gaussian noise for a variance in the range 0.001 to 0.1
Yes, this is what for loops exist for. variance_list=.001:.001:0.01; for k=1:numel(variance_list) J = imnoise(MEANPIC...

8 years ago | 0

| accepted

Answered
How to change elements in several arbitrary positions at the same time
You can use the |sub2ind| function (I used the |bsxfun| function to generate the row numbers) A=[0 0 0 0; 0 0 0 0; 0 0 0 0]...

8 years ago | 0

Answered
MATLAB integer to roman numeral
I wouldn't hard-code the combinations, but use the rule instead. My proposal would look something like this: # convert the ch...

8 years ago | 1

Answered
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
|find| is not guaranteed to result 1 value. It might return a vector, or an empty array. If you are certain there will always be...

8 years ago | 0

Answered
Finding the index of a matrix corresponding to a particular column of another matrix
You can try this: A= [4 12 ; 2 6]; B = [9 4 8 12 ; 2 2 4 6]; selected_col=1; col_in_B=find(all(A(:,selected_col)==...

8 years ago | 1

| accepted

Answered
Finding R squared in a loop
Just a quick note: a negative R-squared is actually possible. It just means your fit is so bad it is even worse than using the m...

8 years ago | 2

Answered
Keep prompting user instead of hitting run each time.
You can wrap your code in a while loop, but that will force the user to hard-break out of your code (ctrl-C on Windows). A nicer...

8 years ago | 1

Answered
How can I create 3D pixels image
The code generating the binary mask is relatively easy to extend, but you'll have to think about the image format you want to sa...

8 years ago | 1

Answered
Gui appears and disappears before user can do anything with it
It is not because the figure is not visible yet, but because the GUI figure is not a callback figure at that point (at the most ...

8 years ago | 0

| accepted

Answered
Calculate residuals as a single number in lsqnonlin function
Yes, the sum of squares or the RMS: SSq=sum(res.^2); RMS=sqrt(mean(res.^2)); The downside of using the plain sum is t...

8 years ago | 1

Answered
Call OpeningFcn each time a button is pressed
There are two strategies I described: # Have a function that you call at the end of |OpeningFcn|. That function only call |ui...

8 years ago | 0

| accepted

Load more