How to divide the column data into variable length?

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

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개)

카테고리

도움말 센터File Exchange에서 MATLAB Coder에 대해 자세히 알아보기

질문:

2018년 11월 28일

편집:

2018년 11월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by