measure time of the algorithm in S-function builder in Simulink
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!