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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -