MATLAB: How to solve this error”Dimensions of matrices being concatenated are not consistent.”

dimensions of matrices being concatenated are not consistent

This error is happened when I used this number in matrix.
r=[3.30125e-07
5.99393e-08
1.17201e-06
5.30199e-07
6.14149e-07
1.35961e-06
1.09962e-06
1.5782e-06
1.89309e-06
2.72393e-06
3.36113e-06
3.44682e-06
3.49249e-06
3.91297e-06
4.42613e-06
5.10713e-06
5.48425e-06
6.34044e-06
6.23161e-06
6.38425e-06
7.84901e-06
8.03945e-06
8.28286e-06
8.58534e-06
8.80845e-06
8.61021e-06
8.07217e-06
8,03E-03
8.38381e-06
7.88861e-06
7.49862e-06
6.67422e-06
6.31096e-06
6.17815e-06
5.63639e-06
5.75767e-06
4.72766e-06
4.20895e-06
3.99089e-06
3.70319e-06
];

Best Answer

Look at this example. A has 3 elements,
>> A = [1 2 3]
A =
1 2 3
B has 2 elements,
>> B = [4 5]
B =
4 5
now concatenate them horizontally (side by side)
>> C = [A B]
C =
1 2 3 4 5 % now C has both A and B
now try vertical concatenation, (up and down)
>> C = [A;B]
Error using vertcat
Dimensions of matrices being concatenated are not consistent.
Why? Because, A has 3 elements wherein B has only 2. This is what is meant by "Dimensions are not consistent. Now let's say B also has 3 elements...
>> B = [4 5 6]
B =
4 5 6
now try again,
>> C = [A;B]
C =
1 2 3
4 5 6
works. Do you understand your problem?