Convert Cell to Matrix

8 ビュー (過去 30 日間)
ha ha
ha ha 2019 年 6 月 26 日
回答済み: madhan ravi 2019 年 6 月 26 日
Let' say, I have cell_A: 5x1 cell
cell_A={ [] ; [1] ; [5]; [] ; [2]};
How can I convert it to be matrix? 5-by-1 matrix
result_matrix=[ []; 1; 5 ; [] ; 2 ];

採用された回答

madhan ravi
madhan ravi 2019 年 6 月 26 日
As sir Walter mentioned already , you cannot have holes in matrices . So you could replace them with nans perhaps:
cell_A(cellfun('isempty',cell_A)) = {NaN};
Matrix = cell2mat(cell_A)

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 6 月 26 日
You cannot. Matrices cannot have "holes" in them.

カテゴリ

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

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by