Output the amount of time it took to run a simulation

3 visualizaciones (últimos 30 días)
Robert Demyanovich
Robert Demyanovich el 25 de Nov. de 2021
Editada: Paul el 26 de Nov. de 2021
My simulations take a long time. I would like to be able to measure the amount of time it took for a simulation to run. I would like to be able to do this even if I prematurely stop the run.

Respuestas (2)

Paul
Paul el 25 de Nov. de 2021
Editada: Paul el 26 de Nov. de 2021
Execute
simout = sim()
Then look at
simout.SimulationMetadata.TimingInfo

Walter Roberson
Walter Roberson el 25 de Nov. de 2021
Put the code to be timed into a function. At the beginning of the function, tic() and assign the result to a variable. Then immediately create an onCleanup that does a toc() of the variable and outputs the result.
If you do this then the time will be output when the function exits, including cases where the function was interrupted.

Categorías

Más información sobre Simulink 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