Graeme Connor
Graeme Connor

Reputation: 11

Merging/interlacing two matrices

I have two matrices, say A and B, each are 133x365.

I want to create a new matrix which contains the first column of A then the first column of B, second column of A then second column of B, and so on.

I think it is some sort of concatenation but I am not sure how to do it.

Thanks!

Upvotes: 0

Views: 693

Answers (1)

f4_
f4_

Reputation: 23

This should do the trick

reshape(permute(cat(3,A,B), [1 3 2]), [m 2*n]);

where [m,n] = size(A)

Upvotes: 1

Related Questions