converting a cell array to a matrix

22 ビュー (過去 30 日間)
AA
AA 2014 年 11 月 26 日
回答済み: Azzi Abdelmalek 2014 年 11 月 26 日
consider the following example
a={rand(1877958,7); rand(1251972,7)};
i want this to be converted to a matrix. i know that the rows are not the same but the remaining rows can be filled with zeros. how can i do that?
thanks

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 11 月 26 日
a={rand(1877958,7); rand(1251972,7)};
n=max(cellfun(@(x) size(x,1),a));
b=cell2mat(cellfun(@(x) [x ;zeros(n-size(x,1),7)],a,'un',0))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by