How to rearrange 3 small matrices to a bigger one with a certain order of rows without using loops

조회 수: 1 (최근 30일)
I guess this one is quite simple but yet I didn't come up with a nice solution:
I have three smaller Matrices that I want to transform to one bigger one with the following order:
>> A1 =
1 1
2 2
A2 =
3 3
4 4
A3 =
5 5
6 6
They should be transformed to one Matrix in this order:
B =
1 1
3 3
5 5
2 2
4 4
6 6
So always take the first row of each matrix, then take all the second ones and so on!
Is there a nice and quick solution that does not require loops?
Thanks in advance again!

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 1월 3일
B=reshape([A1(:)' ;A2(:)'; A3(:)'],size(A1,1)*3,size(A1,2))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by