extract data from cell matrix to matrix

1 回表示 (過去 30 日間)
Jack Tse
Jack Tse 2021 年 3 月 27 日
コメント済み: Jack Tse 2021 年 3 月 27 日
Hi, I am facing an issue with extracting all data from my cell matrix to a martrix.
Cell matrix:
A = ([3*1] [3*1] [3*1]
[3*1] [3*1] [3*1]
[3*1] [3*1] [3*1])
each cell contain a vector:
[3*1] = (1
2
3)
I want to extract into a matrix look like:
B = (1 1 1
2 2 2
3 3 3
1 1 1
2 2 2
3 3 3
1 1 1
2 2 2
3 3 3)
I notice that I can use:
B = [A{1,1} A{1,2} A{1,3}; A{2,1} A{2,2} A{2,3}; A{3,1} A{3,2} A{3,3}]
but this is too messy and unefficient when the cell matrix become larger.

採用された回答

Mario Malic
Mario Malic 2021 年 3 月 27 日
Hi,
B = cell2mat(A);
  1 件のコメント
Jack Tse
Jack Tse 2021 年 3 月 27 日
Thank you.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by