How can we join two matrices of two dimmention

1 Ansicht (letzte 30 Tage)
Abdulkareem
Abdulkareem am 12 Mär. 2014
Beantwortet: Sagar Damle am 12 Mär. 2014
hey everybody i have two matrices of 476*11 i want to join them in one matrix of 952*11 . thanks in advance

Akzeptierte Antwort

Mischa Kim
Mischa Kim am 12 Mär. 2014
Bearbeitet: Mischa Kim am 12 Mär. 2014
Abdulkareem, simply use
C = [A; B];
where A and B are your 476-by-11 matrices.
A = [1 2 3; 4 5 6];
B = [9 8 7; 6 5 4];
C = [A; B]
C =
1 2 3
4 5 6
9 8 7
6 5 4

Weitere Antworten (3)

Sagar Damle
Sagar Damle am 12 Mär. 2014
For two matrices A and B; 1. for horizontal concatenation,use [A,B] or horzcat(A,B). 2. for vertical concatenation,use [A;B]. Also see help about function 'cat()'.

Chris C
Chris C am 12 Mär. 2014
Bearbeitet: Chris C am 12 Mär. 2014
Write it as below assuming that matrix B and A are of the same dimension.
C = [B;A];

nl2605
nl2605 am 12 Mär. 2014
C = horzcat(A,B); If A and Bb are the two matrices.

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by