create cell from array with specified size
Afficher commentaires plus anciens
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)],...}
Réponse acceptée
Plus de réponses (2)
Fangjun Jiang
le 19 Déc 2023
0 votes
num2cell(mymatrix)
2 commentaires
Gaetano Pavone
le 19 Déc 2023
Fangjun Jiang
le 19 Déc 2023
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)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!