Posted By:
23 Mar, 2013 12:01 pm PDT

concatenatenate two matrices and or two arrays into one

I have two martices

A=[1 2 3;4 5 6;7 8 9] and B = [1 1 1; 1 1 1;1 1 1].


I want to concatenate them horizontally and vertically. the horizontal output should be like this:
1 2 3 1 1 1
4 5 6 1 1 1
7 8 9 1 1 1

Vertical output should look like this:
1 2 3
4 5 6
7 8 9
1 1 1
1 1 1
1 1 1

Attachment:None


to concatenate horizontlly

>>cat(2, A, B) or C = [A B];

 

to concatenate vertically

>>cat(1, A, B) %or

>>C = [A; B];

 

Please watch the video for details

Was it useful?  




Please login to reply to this problem.