How to split a matrix into 2 matrixes then join it again?
7 views (last 30 days)
Show older comments
I have a mtrix like this: A =[2,6,3,1,7;9,4,2,6,3;7,1,4,5,3;7,2,5,6,3;4,2,5,3,5]
A =
2 6 3 1 7
9 4 2 6 3
7 1 4 5 3
7 2 5 6 3
4 2 5 3 5
then i want to split it become 2 matrix A1 and A2. So it will be like this:
A1 =
2 6 3 1 7
9 4 2 6 3
7 1 4 5 3
A2 =
7 2 5 6 3
4 2 5 3 5
After i finish with my process with that 2 matrix above, I want join them again into a matrix.
What to do? Thanks before :)
0 Comments
Accepted Answer
Jan
on 7 May 2012
A =[2,6,3,1,7;9,4,2,6,3;7,1,4,5,3;7,2,5,6,3;4,2,5,3,5];
A1 = A(1:3, :);
A2 = A(4:5, :);
B = cat(1, A1, A2); % Or [A1; A2]
These basic array operations are explained exhaustively in the Getting started chapters of the documentation.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!