Run an M-file multiple times

6 visualizaciones (últimos 30 días)
Dipesh
Dipesh el 3 de Nov. de 2012
Comentada: Alexandra el 8 de Nov. de 2016
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?

Respuesta aceptada

José-Luis
José-Luis el 3 de Nov. de 2012
Editada: José-Luis el 3 de Nov. de 2012
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 comentarios
Image Analyst
Image Analyst el 3 de Nov. de 2012
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 el 8 de Nov. de 2016
Hi, I have a model with many many loops and they all have i and j. So what is at risk? Speed?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by