USING MEX TO SPEED UP THE CODE
이전 댓글 표시
I have a matlab code which is computationally intensive and takes more than affordable time to run. I am told mex can be of help. So I have tried converting the code into its C equivalent using Matlab Coder, but am not sure how exactly to compile that in matlab now.
Please help. Thanks in advance
채택된 답변
추가 답변 (1개)
Sriram Tadavarty
2020년 8월 1일
1 개 추천
Hi Yogendra,
Once you generated the mex (MATLAB executable) using MATLAB Coder. Then, observe that there will be a file generated with extensions '_mex'. Use this file to run instead of the actual file, and observe the time taken.
For example, for a function foo, there will be a generated mex file with name foo_mex. Use foo_mex in the same way, the foo is used.
Hope this helps.
Regards,
Sriram
댓글 수: 2
YOGENDRA SINGH BHANDARI
2020년 8월 1일
Sriram Tadavarty
2020년 8월 1일
Hi Yogendra,
Thanks for sharing the results. I am actually not sure as what inbuilt MATLAB functions are used in R2RMODEL3.
There could be sometimes, even the mex would take longer time, than native MATLAB code. It depends on the functions that are used. For more information about mex being slower is answered here.
Please have a look and see if it was helpful.
Regards,
Sriram
카테고리
도움말 센터 및 File Exchange에서 MATLAB Coder에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

