Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Converting a variable sized cell array to a matrix

1 回表示 (過去 30 日間)
Jay Vaidya
Jay Vaidya 2020 年 11 月 16 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have a cell as below:
5 -3 11
2 3 7
-9 7
-1 3 2 4
-4
I want to convert this to a matrix. I don't know the maximum columns of the data. That means, given a cell, first I need to split the data and see what is the maximum number of columns and then generate the matrix accordingly.
  1 件のコメント
the cyclist
the cyclist 2020 年 11 月 16 日
編集済み: the cyclist 2020 年 11 月 16 日
The way you have written this, it leaves a lot of ambiguity. Is this an accurate definiion for your cell array?
C = {5, -3, 11, [];
2, 3, 7, [];
-9, 7, [], [];
-1, 3, 2, 4;
-4, [], [], []};
If not, can you define it in MATLAB notation, or upload it here in a MAT file?

採用された回答

Sourabh Kondapaka
Sourabh Kondapaka 2020 年 11 月 18 日
As the cyclist has suggested, its not entirely clear what the elements are.
Inorder to convert a cell to matrix/array, we have cell2mat() function which can help with this.
If this is still not clear. Please upload a .mat file of the variable using save() method in matlab.

その他の回答 (0 件)

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by