How to calculate the run time for m.file?
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have m. file and I want to calculate its run time I, I convert the m.file to functiion and call it in another file
state1 = finalisa3() tt=timeit(state1)
but I get error " Undefined function 'timeit' for input arguments of type 'char'.
Error in ch (line 36) tt=timeit(state1)"
0 Kommentare
Antworten (1)
Raghava S N
am 31 Dez. 2024
Verschoben: Walter Roberson
am 31 Dez. 2024
Hi,
The input to the function "timeit" should be a function handle as mentioned in the documentation - https://www.mathworks.com/help/matlab/ref/timeit.html#btx36ta-f:~:text=Function%20to%20be%20measured%2C%20specified%20as%20a%20function%20handle.%20f%20is%20either%20a%20handle%20to%20a%20function%20that%20takes%20no%20input%2C%20or%20a%20handle%20to%20an%20anonymous%20function%20with%20an%20empty%20argument%20list.
For an example that demonstrates the usage of the "timeit" function to measure code performance, refer to this link - https://www.mathworks.com/help/matlab/ref/timeit.html#d126e1852968:~:text=Compare%20Time%20to%20Execute%20Custom%20Preallocation%20to%20Calling%20zeros.
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!