Make various matrices in one for loop. Hellow, its problaly very easy but i cant find it nowhere.
I want to make a program that produces several matrices. to make ten matrices i tried:
for i=0:10
matrix[i] = rand(12,12)
end
to make 10 matrices with 12x12 random numbers but i doesnt work. Thx in advance

 採用された回答

Matt Fig
Matt Fig 2011 年 5 月 1 日

3 投票

for ii=0:9
matrix{ii+1} = rand(12,12);
end

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2011 年 5 月 1 日

1 投票

First off, you want to create 10 matrices but you execute the loop 11 times.
Secondly, indexing at 0 does not work for any predefined MATLAB array types.
But to see the answer to your question, please read this FAQ

カテゴリ

ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by