Why does this code give error?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sadiq Akbar
am 15 Feb. 2023
Kommentiert: Sadiq Akbar
am 16 Feb. 2023
I want to implenet timeit() function to find the machine time for the execution of the m-file 'fpa1.m'. But when I run the attached 'main.m', it gives me the following error:
Error using timeit
First argument must be a function handle that takes no input argument.
Error in main (line 6)
fprintf('time taken by fpa1 = %e seconds', timeit(@fpa1,3))
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 15 Feb. 2023
fcn = @() fpa1(10,0.8,2000,4,[-90 -90 -90 -90],[90 90 90 90],@(b)myfunction(b,u,Noise));
timeit(fcn, 3)
10 Kommentare
Walter Roberson
am 16 Feb. 2023
The original version of the timeit() function is in the File Exchange. You could load it from there and modify it.
But suppose it gives different output results on different timing iterations, then which version should be output?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical 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!