how can i combine arrays of different size.

3 ビュー (過去 30 日間)
zhoug zho
zhoug zho 2021 年 5 月 31 日
回答済み: Walter Roberson 2021 年 5 月 31 日
i have six arrays of size as given in figure.
i need to combine all arrays one after the other.
but the problem is they are of different dimenion.
how can i combine all these arrays?
thanks in advance.
  4 件のコメント
zhoug zho
zhoug zho 2021 年 5 月 31 日
yes, pad with zeros.
zhoug zho
zhoug zho 2021 年 5 月 31 日
編集済み: zhoug zho 2021 年 5 月 31 日
how can i combine these arrays by padding with NaN or zeros.?

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

採用された回答

Walter Roberson
Walter Roberson 2021 年 5 月 31 日
sizes = cell2mat(cellfun(@size, YourCell(:), 'uniform', 0));
maxcols = max(sizes(:,2));
combined = cell2mat(cellfun(@(M) [M, zeros(size(M,1), maxcols-size(M,2))], YourCell(:), 'uniform', 0));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by