Borrar filtros
Borrar filtros

program runtime question

1 visualización (últimos 30 días)
darksideofthemoon101
darksideofthemoon101 el 6 de Abr. de 2011
Hi,
I have a program that (for what I've done so far) takes a long time to run (~4s per loop). In the final version of the code I will be performing hundreds of loops. Would it be quicker if I assigned parts of the code as functions, or would this actually increase the run time?
Thanks
Richard

Respuesta aceptada

Walter Roberson
Walter Roberson el 6 de Abr. de 2011
It is difficult to predict exactly how MATLAB will optimize code. Especially before 2010b, the details how how the code was written in the file could make a substantial difference. This is one of those "You'd have to try it and see" matters.
Have you used the profiler to track down the portion of your code that is taking a lot of time?
  1 comentario
darksideofthemoon101
darksideofthemoon101 el 6 de Abr. de 2011
No, I might try this. Thanks Walter (and everyone else on here), you guys are great!

Iniciar sesión para comentar.

Más respuestas (1)

Jason Ross
Jason Ross el 6 de Abr. de 2011
Have you looked into using functions from the Parallel Computing Toolbox (parfor, spmd, etc)?
Of course, not knowing your problem, you may have conditions that prevent the use of these functions.

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