Setting up an array which has a 4x1 matrix in each one of it's cells
Ältere Kommentare anzeigen
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 Kommentar
James Tursa
am 7 Feb. 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?
Akzeptierte Antwort
Weitere Antworten (2)
Jan
am 7 Feb. 2013
X = cell(10,10);
X(:) = {zeros(4, 1)};
Jos (10584)
am 7 Feb. 2013
X = repmat({zeros(4,1)},10,10)
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!