Concatenate More than 2 Variables

1 Ansicht (letzte 30 Tage)
RDG
RDG am 8 Okt. 2013
Kommentiert: Walter Roberson am 8 Okt. 2013
Can Matlab handle concatenation of more than 2 variables?
eg.
A{1}=[1 2 3]
A{2}=[4 5 6]
I understand that C=vertcat(A{1},A{2}).
However, if I have say 100 variables and I wish to vertcat them, how can I do so?
eg.
A{1}=[1 2 3]
A{2}=[4 5 6]
A{3}=[7 8 9]
A{4}=[10 11 12]
and so on....until A{30}.
How can I do so with a single function?

Akzeptierte Antwort

Matt J
Matt J am 8 Okt. 2013
Or,
C=cell2mat(A);
  2 Kommentare
RDG
RDG am 8 Okt. 2013
cell2mat only converts Cell to Double. It doesn't concatenate.
Walter Roberson
Walter Roberson am 8 Okt. 2013
Actually it does concatenate.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices 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