measure time of the algorithm in S-function builder in Simulink

3 Ansichten (letzte 30 Tage)
wietjes
wietjes am 13 Apr. 2016
Bearbeitet: wietjes am 13 Apr. 2016
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.

Antworten (0)

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!

Translated by