create cell from array with specified size
이전 댓글 표시
Hello,
Let mymatrix a 24x1 double, how is it possible to obtain a group as specified_sizex1 cell?
For example:
mymatrix=[1:24];
group={[mymatrix(1) mymatrix(2)],...}
채택된 답변
추가 답변 (2개)
Fangjun Jiang
2023년 12월 19일
0 개 추천
num2cell(mymatrix)
댓글 수: 2
Gaetano Pavone
2023년 12월 19일
Fangjun Jiang
2023년 12월 19일
mat2cell(mymatrix,[1],[6, 6, 6, 6])
mymatrix = (1:24).'
specified_size = 4;
assert(mod(numel(mymatrix),specified_size)==0, ...
'numel(mymatrix) is not a multiple of specified_size')
group = num2cell(reshape(mymatrix,[],specified_size).',2)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!