MATLAB: Error using vertcat. Dimensions of matrices being concatenated are not consistent.
vertcat
a=[ones(1,c);[ap',a]];
b=eye(c,1);
q=a/b
For this line of code, I got error using vertcat. Is there any solution for this?
Best Answer
The error message is clear. You're vertically concatenating a matrix withc columns,ones(1, c) with a matrix with a different number of columns,[ap', a]. Since the number of columns does not match you get an error.
As we have no idea what you're doing it's difficult to tell you how to solve the problem, other than make sure thatc is the number of column in[ap', a], that isc must be equal tosize(ap, 1) + size(a, 2) (number of rows inap since you transpose it + numbers of rows ina).
Best Answer