Cong Zhao
Cong Zhao

Reputation: 11

Convert Matlab m files into C/C++ codes using Matlab Coder, including mex files (mxArray)

I'm using Matlab Coder to generate C/C++ codes from a matlab .m file, which calls external C/C++ functions. I did some work and found "code.ceval" made it worked.

But it gets complicated when the .m file calls external mex-files (with mxArray). Fortunately I have the original C/C++ codes for the mex-files.

Could anyone tell me how to include mex-files (with mxArray inputs/outputs) when generating C/C++ codes using Matlab Coder, or give me an example?

Best, Yours, Cong

Upvotes: 1

Views: 1079

Answers (1)

Navan
Navan

Reputation: 4477

mex files need to be run with MATLAB. They cannot be run outside MATLAB. If you are generating mex files using MATLAB coder you can call other mex and MATLAB functions using coder.extrinsic. Otherwise you can only call regular C functions.

Upvotes: 1

Related Questions