how to cell array data in single matrix

1 回表示 (過去 30 日間)
singh
singh 2015 年 5 月 27 日
編集済み: Stephen23 2015 年 5 月 27 日
suppose i have an cell array code and output of this cell array is below
code=
b=cat(2,indx,nonzeros(a));
c{i}=b;
output=
c =
[4x3 double] [3x3 double] [2x3 double] [1x3 double]
>> c{1}
ans =
1.0000 2.0000 2.0251
1.0000 3.0000 2.4151
1.0000 4.0000 3.6898
1.0000 5.0000 3.7661
>> c{2}
ans =
2.0000 3.0000 4.4384
2.0000 4.0000 3.3449
2.0000 5.0000 2.0825
>> c{3}
ans =
3.0000 4.0000 5.1293
3.0000 5.0000 6.0171
c{4}
ans =
4.0000 5.0000 2.5647
how to use all data of cell array in the single matrix
  2 件のコメント
Muhammad Usman Saleem
Muhammad Usman Saleem 2015 年 5 月 27 日
to me this is not not possible as matrix always contains same data type while the cell array contains different data type. One thing can be done. You have to make separate matrixs for every field of cell array...
Stephen23
Stephen23 2015 年 5 月 27 日
編集済み: Stephen23 2015 年 5 月 27 日
@Muhammad Usman Saleem: the contents of each cell is clearly labeled as being of class double, so actually these can be concatenated together:
c =
[4x3 double] [3x3 double] [2x3 double] [1x3 double]

サインインしてコメントする。

採用された回答

Andrei Bobrov
Andrei Bobrov 2015 年 5 月 27 日
out = cat(1,c{:});
  1 件のコメント
singh
singh 2015 年 5 月 27 日
thanks andrei

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by