measure time of the algorithm in S-function builder in Simulink
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm trying to create a sorting algorithm in simulink. You can't use matlab-function blocks because it's a recursive function, so I have to use the S-function builder. Now I want to know how long the algorithm takes for a different inputrange. This is my code:
clock_t begin = clock();
sort(x,0,999);
clock_t einde = clock();
*time = (einde - begin) / CLOCKS_PER_SEC;
The sorting function works fine. But the output for time is the first element in the sorted array. Which makes no sense!?
Anyone knows what might cause the problem? btw tic;toc; doesn't work in simulink, you have to write your own code.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Simulink Functions 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!