How to compile code for other Matlab users

Hi, Before embarking in any too difficult task, I would like to understand if it is possible to do the following thing: 1) compile a set of m-files user-created that also include calls to functions from some toolboxes (no particularly fancy things, maybe Java class included only) 2) use the compiled versions of the m-files on another computer that has Matlab installed but not necessarily the toolboxes 3) In practice, i want to use on the 2 machines the same way to call the functions i created, and normally use matlab on the second one.
The guide seems to suggest it is possible, but I cannot figure out the step by step approach. Any help is greatly appreciated. \Regards

回答(3 个)

If you are calling into certain toolbox functions in your MATLAB scripts/functions, you need the same toolboxes installed on any other machine to be able to run your functions correctly. If these are third-party toolboxes not restricted by licensing considerations, you can always package your functions with the required toolbox directories and run them elsewhere.
Also, could you please clarify what you mean by "compiling"? Do you mean simply writing MATLAB functions/scripts or actually compiling MATLAB code into binaries using MATLAB Compiler?
Do you want to protect your code from the other user editing? if so you have 2 options
1. Compile using matlab compiler
2. Pcode your m files.
each of these has issues (based on what you describe above)
1. If you compile a dll you cant load that back into Matlab (as far as I remember)
2. Your other computer will need the same toolboxes as you have for this to work.
If you can explain a bit more of what you want to do then it might be a bit more clear how to help you.
Matteo
Matteo 2011-4-11
Hi, yes i think your answers are actually solving my questions. I meant compiling in the sense of creating a dll with the matlab compiler and - yes, if you know i need the same packages in the other machine, that also answers my question. thanks to both
regards Matteo

2 个评论

If you create a binary, then as far as I _know_ the destination machine does not need a license for the toolboxes you used. I could be wrong on that point.
If you create an exe with the matlab compiler you are correct.
If you create a DLL however Mathworks does not allow a matlab created DLL to be loaded into Matlab (to stop users compiling up toolboxes to use as toolboxes)

此问题已关闭。

提问:

2011-4-7

关闭:

2021-8-20

Community Treasure Hunt

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

Start Hunting!

Translated by