Matlab Vertcat function error [closed] - matlab

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
Help I'm developing an application in matlab using the Vertcat functon.
But I got this error in Matlab..
??? Error using ==> vertcat
CAT arguments dimensions are not consistent.
Error in ==> imgMaskMed at 31
copy_matrix = vertcat(copy_matrix, copy_matrix(a_temp,:));
Here is my code where the error located
copy_matrix = vertcat(copy_matrix, copy_matrix(a_temp,:));
What is wrong with my code?

It's hard to know with the little information you provide, but my guess is that your copy_matrix has more than 2 dimensions. For example, if it's a 3D array you should use
copy_matrix = vertcat(copy_matrix, copy_matrix(a_temp,:,:));
If it's 4D use
copy_matrix = vertcat(copy_matrix, copy_matrix(a_temp,:,:,:));
and so on.

Related

I am trying to use the code to create graphs in MATLAB but its not working [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I need help with my Matlab code. It is not working, it keeps giving me errors on the same line. I don't know how to fix it, can you please help? I am trying to make graphs in Matlab.
clc
num=(1);
dem=[1 3 10 0];
Ls=tf(num,dem);
relocus(Ls)
The error is:
Error in Matlab (line 4)
Ls=tf(num,dem);
Correct the function 'relocus' to 'rlocus'.
num=(1);
dem=[1 3 10 0];
Ls=tf(num,dem);
rlocus(Ls)
clc

I can't find all the errors occurring in my codes [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
For matalb there's an error at line 9, where I define dy(1), but it doesn't say what kind of error.
function dy=pred_prey(t,y)
k=1;
a=2/3;
d=4/3;
f=#(x)cos(x.^2)
r=#(t)integral(f,0,t);
mu=#(t)13/20-(3/5)*exp(-(3/t));
dy(1)=(y(1)+k)*r-a*y(1)*y(2);
dy(2)=-mu*y(2)+d*y(1)*y(2);
dy=dy';
You define r as an anonymous function, but you don't pass any arguments to it when you call it on line 9. The line should be (I assume):
dy(1) = (y(1)+k)*r(t)-a*y(1)*y(2);
Incidentally, you're going to have the same problem on the next line where you call mu with no arguments as well.

MATLAB help for cell disruption modelling [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
i keep getting the error "Error using -""Matrix dimensions must agree"
for this piece of code. Can anybody help me and identify where i'm going wrong? I should be getting 8 plots of f vs d.
P=500;
N=1:1:8;
a=-0.4;
b=-1;
Kd=700;
d50star=(1./(10.^(Kd*(N.^a)*(P-115).^b)))
w0=0.45;
d=0:0.1:10
d50N0=5;
if d50star < 0.33;
w=(1-(2.3*d50star))*w0
else
w=(3.4-(5.5*d50star))*w0
end
d50=(1-d50star)*d50N0;
f=1-(1./((1+exp((d-d50)/w))))
There are at least two errors in the script:
1) in the last line [f=1-(1./((1+exp((d-d50)/w))))]
d size is 1x101
d50 size is 1x8
The size inconsistency is related to the definition of:
N=1:1:8; and
d=0:0.1:10
2) depending on the algoroth, it could be ./w instead of /w
Hope this helps.

I is not a real numeric array of class SINGLE [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I'm using the computer vision: VLfeat library to compute a HOG descriptor of an image, and after inputing this code:
cellSize = 8 ;
hog = vl_hog(im, cellSize, 'verbose') ;
I get this error in MATLAB, and when I google it I really can't find any possible explanation:
Error using vl_hog
I is not a real numeric array of class SINGLE.
After going over the code (found here) I'm also not sure what the variable I is:
Hopefully, I haven't missed something elementary ...
library source
As the asker already found out, the I refers to the first input argument.
Hence this should solve the problem:
hog = vl_hog(single(im), cellSize, 'verbose')

i have an error "Index exceeds matrix dimensions" [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
i have an error "Index exceeds matrix dimensions" in matlab code .
the error appeared in second line of this code
for i=1:2
layer = I4(:,:,i);
intensity(i) = double(median(layer(mask)));
end
intensity
expressionLevel = log(intensity(1)/intensity(2))
this code is a part of a long program
If there is no 3rd dimension in I4, when i=2 you will get this error. Try this in MATLAB:
I4=rand(3,3)
I4(:,:,1) % This will not give you an error.
I4(:,:,2) % This will give you an "Index exceeds matrix dimensions" error.