How to convert a 1XM array into NXM array?

4 次查看(过去 30 天)
I have a 1x12 array, where each element is a vector of doubles (the vectors have different lengths). How can I convert to a NX12 array, where N is the length of the vector with most elements.

采纳的回答

Stephen23
Stephen23 2018-8-23
编辑:Stephen23 2018-8-23
You could do this yourself, but by far the simplest solution is to download Jos's excellent padcat:
If C is your 1x12 cell array, then just do this:
padcat(C{:})
  1 个评论
theblueeyeswhitedragon
The 1x12 cell array had a few empty vectors as elements. This caused the function to give a subscripted assignment dimension mismatch error in X = cat(dim, varargin{:})
Replaced those vectors with nan and it worked fine. Thanks.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by