assume that a={[1 2 3],[2 3 4;1 2 3]} I want to convert a into a=[1 2 3;2 3 4;1 2 3]. Is there any easy way? thanks

 Akzeptierte Antwort

Stephen23
Stephen23 am 12 Feb. 2016

0 Stimmen

>> a={[1 2 3],[2 3 4;1 2 3]}
a =
[1x3 double] [2x3 double]
>> vertcat(a{:})
ans =
1 2 3
2 3 4
1 2 3

Weitere Antworten (1)

Kiran
Kiran am 12 Feb. 2016

0 Stimmen

Hi Song,
You can use 'cat' command to concatenate array according to your need.
m = cat(1,a{1},a{2})
Above command will concatenate the array 'a' along vertical direction as you need.

Kategorien

Gefragt:

am 9 Feb. 2016

Beantwortet:

am 12 Feb. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by