Setting up an array which has a 4x1 matrix in each one of it's cells
Afficher commentaires plus anciens
Hi,
Would anyone be able to give me any help on how to set up a 10x10 array such that each cell within this array is a 4x1 matrix? I'm not sure if this is the correct terminology or if it's called something else. However my basic problem is that I'm calculating something within 2 loops (both with 10 cycles hence the 10x10) and want to record the result in an array/matrix for each case so that it may be stored. The value I want to store is a 4x1 matrix.
Thanks in advance,
Nick
1 commentaire
James Tursa
le 7 Fév 2013
This often doesn't make sense except in special circumstances (e.g., modifying each cell's data area in-place downstream in your code). If you are replacing each cell element downstream in your code with another 4x1 matrix, then this pre-allocation is just a waste of time. What are you doing with this cell array downstream in your code?
Réponse acceptée
Plus de réponses (2)
Jan
le 7 Fév 2013
X = cell(10,10);
X(:) = {zeros(4, 1)};
Jos (10584)
le 7 Fév 2013
X = repmat({zeros(4,1)},10,10)
Catégories
En savoir plus sur Creating and Concatenating Matrices 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!