Setting up an array which has a 4x1 matrix in each one of it's cells
古いコメントを表示
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 件のコメント
James Tursa
2013 年 2 月 7 日
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?
採用された回答
その他の回答 (2 件)
Jan
2013 年 2 月 7 日
X = cell(10,10);
X(:) = {zeros(4, 1)};
Jos (10584)
2013 年 2 月 7 日
X = repmat({zeros(4,1)},10,10)
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!