How do you return computational time and memory allocated during function call?

1 vue (au cours des 30 derniers jours)
Sarah
Sarah le 28 Fév 2025
I am trying to save the computational time and memory allocated during a function call to two variables (that can then be saved to a text file). How do I return both, as well as the normal output of my function, when calling my function?

Réponses (1)

Star Strider
Star Strider le 28 Fév 2025
There are a few functions you can use for timing, one of which is the tic, toc pair. Most current recommendations are to use duration arrays for this, although in the past, using clock and etime were appropriate.
For memory usage, the memory and inmem funcitons are available.
There may be File Exchange contributions that could do what you want, so search there as well.
.

Catégories

En savoir plus sur Performance and Memory dans Help Center et File Exchange

Produits


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by