How to convert from a matrix to a cell?

1 回表示 (過去 30 日間)
SM
SM 2020 年 7 月 17 日
コメント済み: Star Strider 2020 年 7 月 19 日
Given matrix is
A=[1 2 3 4 5 6 7 8; 9 10 11 12 13 14 15 16];
and output is
B={[1 2 3 4],[5 6 7 8];[9 10 11 12],[13 14 15 16]};
How can I do that?

採用された回答

Star Strider
Star Strider 2020 年 7 月 17 日
Use the mat2cell function:
A=[1 2 3 4 5 6 7 8; 9 10 11 12 13 14 15 16];
B = mat2cell(A, [1 1], [4 4]);
B11 = B{1,1} % Check Output
B22 = B{2,2} % Check Output
  2 件のコメント
SM
SM 2020 年 7 月 19 日
Thank you so much!
Star Strider
Star Strider 2020 年 7 月 19 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSemiconductors and Converters についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by