I have created an M-file which gives me random stuff using random numbers. I want to run this file 1000 times. How do I do this without having to press F5 1000 times?

 採用された回答

José-Luis
José-Luis 2012 年 11 月 3 日
編集済み: José-Luis 2012 年 11 月 3 日

0 投票

for ii=1:1000
your_m_file_name %the .m is not necessary
end
Provided you are in the directory your m-file resides in, or that it is located in Matlab's path.

6 件のコメント

Dipesh
Dipesh 2012 年 11 月 3 日
is that for loop in the same script as my mfile or a new mfile completely?
José-Luis
José-Luis 2012 年 11 月 3 日
編集済み: José-Luis 2012 年 11 月 3 日
New m-file, or the command line. Or you could just add a loop to your script (no need for your_m_file_name then)
Dipesh
Dipesh 2012 年 11 月 3 日
Also, one more thing, is the "ii" a recognized matlab command? what does it mean if its not and how would I code it into my mfile?
José-Luis
José-Luis 2012 年 11 月 3 日
No, it's the loop counter. You could use other names. Look at the documentation for for:
doc for
Image Analyst
Image Analyst 2012 年 11 月 3 日
He used ii instead of i because it's good practice not to use i or j for loop indexes because they are the imaginary variable.
Alexandra
Alexandra 2016 年 11 月 8 日
Hi, I have a model with many many loops and they all have i and j. So what is at risk? Speed?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

タグ

質問済み:

2012 年 11 月 3 日

コメント済み:

2016 年 11 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by