MATLAB Answers

Generate code: source code or mex file ?

5 ビュー (過去 30 日間)
Maria
Maria 2020 年 7 月 31 日
コメント済み: Maria 2020 年 8 月 5 日
Hi,
it has only been a few days since I am dealing with mex files.
I am using Matlab coder. I can convert my original m files without any problems, but now I've got a doubt on which "build type" to choose. I was, without thinking too much, selecting the "Source code". I got the .mexw64, and I run the function name_function_mex in my Matlab code.
I saw now that, based on the description, the source type "MEX" should be more suitable, because it is a compiled code to be run in Matlab. I also tried the "MEX" built type, and the only difference I see is that I get a lot more files in the generated mex-related folder.
So my question is: why did the "source code" work at all in my case? Since it was working in my Matlab code (I could call the name_function_mex function as any other functions), should I still consider the build type "MEX" for some special reason...?

採用された回答

Darshan Ramakant Bhat
Darshan Ramakant Bhat 2020 年 8 月 2 日
From your description I am assuming that you are using coder app.
When the "build type" is "Source code" it is not suppose to generate any MEX files. The correct configuration to generate MEX is the "MEX" build type.
I had tried "Source Code" configuration with a simple example, but I did not get any MEX file generated. Please attach the .prj file along with all the input files so that I can try to reproduce this from my end.
  3 件のコメント
Maria
Maria 2020 年 8 月 5 日
Now is clear! Perfect, now I understood! I will use the MEX build type. Thank you very much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by