Is mex a deployable function in a compiled application?

1 view (last 30 days)
I have some code that runs the mex command to generate files on the fly and it runs fine within Matlab however, if I compile the code and run it using MCR it throws an error. I found this article but can't seem to find anywhere conclusively that mex won't run:

Accepted Answer

Jan
Jan on 22 Nov 2014
The mex command has a strange and bewildering structure: It is an M-file, which calls perl, which reads a .bat file, but does not run it, but interpretes it and use it as input to start the executable of the actual compiler. I'm not sure if this is still the case in R2014b, but it was such complicated for a long time.
Calling the executable of a compiler could be done with a simple system call, but the required arguments depend on the compiler. If you are sure, that a specific compiler is installed on the computer your deployed function runs on, you can copy the calling sequence from the perl script.
Note: You code creates source files dynamically? Such meta programming is an additional level of abstraction, which impedes debugging. In most cases it is possible to find a simpler method with a fixed program and the flexibility is implemented by variables in the input.

More Answers (0)

Categories

Find more on Package MATLAB Functions in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!