Can I use Matlab Coder generated Mex functions on another computer

3 visualizzazioni (ultimi 30 giorni)
I've been able to use Matlab Coder to generate Mex Functions that work on my computer; but I cannot find any instructions on how to use these Mex functions on other computers that have Matlab (and that don't have Matlab Coder). Is there a straight forward way to move the c-code it generates to another system to create the mex function?

Risposta accettata

Ryan Livingston
Ryan Livingston il 5 Mag 2014
To run a MEX function generated by MATLAB Coder™, you must have licenses for all the toolboxes that the MEX function requires. For example, if you generate a MEX function from a MATLAB algorithm that uses a Computer Vision System Toolbox™ function or System object, to run the MEX function, you must have a Computer Vision System Toolbox license.
The other computer should also match the architecture of the computer on which the MEX function was generated.
Are you having any specific issues when you try to run the MEX function on another machine?
  3 Commenti
Fred Smith
Fred Smith il 6 Mag 2014
The generated MEX function relies on DLLs present in MATLAB. Those DLLs are forward (but not backward) compatible.
Therefore, the MATLAB you are running the generated MEX-function inside needs the same version or a newer version than the version you generated the MEX-function on.
You can create a MEX-function for an earlier version of MATLAB but it is a lot more work. First generate code for a static library. Standalone code (any of the non-MEX targets) generally do not rely on MATLAB's DLLs. Of course, they don't interact with the MATLAB environment at all.
Once you have a standalone library, write your own C MEX entry point by hand that calls the static library. Use the MEX command to create a MEX-function.
Another possibility is to generate a DLL and try loadLibrary. Depending on the nature of the arguments being passed in and out this may work fine.
Ryan Livingston
Ryan Livingston il 7 Mag 2014
Modificato: Ryan Livingston il 7 Mag 2014
Most licenses permit you to download and install older versions of MATLAB as well. It may be simplest to generate the MEX function using R2013a assuming that R2013a has the features you require.
Instructions on installing an older version:

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by