Peter Li
Peter Li

Reputation: 83

How to make two matrices intersect with each other?

I have two cell matrices A and B, the size of which are both 10*1 cell matrix. For A, it looks like:{A1;A2;A3;...A10}. For B, it looks like:{B1;B2;B3;...B10}.

Ai and Bi are both 1*200 double vectors.

My question is how to make it looks like cell matrix C, the format of which is :{A1;B1;A2;B2;A3;B3;...A9;B9;A10;B10}.

Is there anybody can help me? Thanks a lot!!

Upvotes: 0

Views: 90

Answers (1)

MeMyselfAndI
MeMyselfAndI

Reputation: 1320

See http://www.mathworks.nl/help/matlab/matlab_prog/combine-cell-arrays.html for details on how to combine cells.

An answer is:

C = [A,B]';
C = C(:);

Upvotes: 4

Related Questions