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!

