How to merge matrix and array of different size in MATLAB? -
i have 1 matrix of size 12 , array of size 4 given below:
a=[23,45,1;4,6,7;9,5,0;145,65,32]; b=[3,2,4,6];
i want new array c
c=[23,45,1,4,6,7,9,5,0,145,65,32,3,2,4,6];
i did following :
a=[23,45,1;4,6,7;9,5,0;145,65,32]; b=[3,2,4,6]; a=reshape(a',12,1); b=b(:); c=[a b];
but giving error :
error using ==> horzcat cat arguments dimensions not consistent.
a = a(:); b = b(:); c = [a; b];
note difference between [a b] or [a, b] , [a; b].
Comments
Post a Comment