MATLAB: Concatenate

concatenation

Dear matlabians
I have a cell variable z = (hello1 hello2 hello3) another cell variable y = (bye1 bye2 bye3) and a double x = (1;2;3 , 4;5;6 , 7;8;9)
how i can I concatenate them in a 5×3 vector
v = (hello1;bye1;1;2;3 , hello2;bye2;4;5;6 , hello3;bye3;7;8;9)
thank you

Best Answer

This makes the 5x3 that you requested.
c1 = {'hello' 'world' 'Happy Tuesday'};
c2 = {'Need' 'coffee' 'now'};
m1 = magic(3);
C = vertcat(c1,c2,num2cell(m1));
To make a 3x5 use;
C = horzcat(c1',c2',num2cell(m1));