MATLAB: Error using vertcat CAT arguments dimensions are not consistent.

vector

>> y=[71. 8829,23.6291,87.1431,16.3153,34.6145,25.6653,44.7321,19.1620,69.4536,73.6550,21.3468;
11.5840,10.3016,1.3980,6.2992,5.3152,12.4589,11.5234,10.6321,10.3478,13.4277,11.2086;
11.5810,10.3016,1.3980,6.2992,5.3152,12.4589,11.5234,10.6321,10.3478,13.4277,11.2086;
7.8103,8.5148,0.7738,6.354,5.7532,10.8831,2.0036,7.4165,9.5611,7.3412,10.2158];
Error using vertcat
CAT arguments dimensions are not consistent.
I got this error. kindly tell me to how to correct it.

Best Answer

Raman - the error message is telling you that the vertical concatenation of the rows in y is failing because not all rows have the same number of columns. Rows 2 through 4 have 11 elements, whereas the first row appears to have 12 because of the space between 71. and 8829. Just remove this space as
y=[71.8829,23.6291,87.1431,16.3153,34.6145,25.6653,44.7321,19.1620,69.4536,73.6550,21.3468;
11.5840,10.3016,1.3980,6.2992,5.3152,12.4589,11.5234,10.6321,10.3478,13.4277,11.2086;
11.5810,10.3016,1.3980,6.2992,5.3152,12.4589,11.5234,10.6321,10.3478,13.4277,11.2086;
7.8103,8.5148,0.7738,6.354,5.7532,10.8831,2.0036,7.4165,9.5611,7.3412,10.2158];
and you will be able to create the matrix y.