Mex file from multiple sources

7 Ansichten (letzte 30 Tage)
ezgi koker
ezgi koker am 23 Feb. 2017
Beantwortet: Jan am 23 Feb. 2017
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.

Antworten (1)

Jan
Jan am 23 Feb. 2017
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.

Kategorien

Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by