Azzera filtri
Azzera filtri

How to split a matrix into 2 matrixes then join it again?

1 visualizzazione (ultimi 30 giorni)
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 :)

Risposta accettata

Jan
Jan il 7 Mag 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.

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by