how can i combine arrays of different size.

4 次查看(过去 30 天)
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
编辑: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 CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by