Mex file is faster when it is called from command but slower when it is called inside a code!!!
이전 댓글 표시
Hi everyone,
I am working on an optimization problem which needs to run my model several times and test for different constraints and cost. For this reason I need a model which can be simulated quickly. The solution which I found is to convert the model to a mex file. I have converted a part of the model to mex file... Now when I run this part alone to check if it is faster than m file, I observe that it is faster about 4 times. However, when I plug this mex file to the rest of the model, the result becomes slower....
Does any of you have an idea what can be a possible reason? Thanks in advanced, Reza
댓글 수: 1
Jan
2012년 12월 8일
How did you measure the timings? I do not think that anybody can guess the reasons without seeing the code.
답변 (1개)
Walter Roberson
2012년 12월 8일
0 개 추천
If you have a "clear all" call, get rid of it.
댓글 수: 4
Aragorn_
2012년 12월 8일
Walter Roberson
2012년 12월 8일
Is this Simulink or MATLAB directly?
Aragorn_
2012년 12월 8일
Walter Roberson
2012년 12월 8일
Could you profile the code to determine where it is spending its time?
카테고리
도움말 센터 및 File Exchange에서 MATLAB Compiler에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!