How to divide the column data into variable length?

2 次查看(过去 30 天)
I have a column vector of size A=20. I want to divide this column vector into 5 smaller vector of size 5,4,3,6 and 2. Such that a1 is of size 5x1,a2 size=4x1 and so on.

采纳的回答

TADA
TADA 2018-11-28
编辑:TADA 2018-11-28
a = rand(20,1);
c = mat2cell(a, [5,4,3,6,2], 1);
  2 个评论
kitty varghese
kitty varghese 2018-11-28
I am getting the following error
Input arguments, D1 through D2, should be vectors.
TADA
TADA 2018-11-28
编辑:TADA 2018-11-28
yes, I wrote it wrong at first,
should work fine now.

请先登录,再进行评论。

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by