Mex file from multiple sources

7 vues (au cours des 30 derniers jours)
ezgi koker
ezgi koker le 23 Fév 2017
Réponse apportée : Jan le 23 Fév 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.

Réponses (1)

Jan
Jan le 23 Fév 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.

Catégories

En savoir plus sur MATLAB Compiler dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by