Mex file from multiple sources

7 ビュー (過去 30 日間)
ezgi koker
ezgi koker 2017 年 2 月 23 日
回答済み: Jan 2017 年 2 月 23 日
I have two C codes. First one is the main code and the second one is for the initial arrangements, the calling of the main code and printing of the results. I want to convert this to mex file and access it from MATLAB. How should I convert them so that I can access to both functions?
Thanks.

回答 (1 件)

Jan
Jan 2017 年 2 月 23 日
You can compile them together:
mex -O main.c printing.c
Then you can access the main function only. Either you include a wrapper in the mexFunction(), which forward calls to the subfunctions e.g. triggered by the first input. Or you compile two functions:
mex -O main.c
mex -O printing.c
Then you can call the printing lib directly from Matlab or through mexCallMATLAB from the main.mex function. There is an undocumented function mexRunMexFile also, but I'd hesitate to use it.

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by