MATLAB: Calling m functions from a deployed matlab application

loadlibraryMATLAB Compilerstandalone application

We have written and deployed a matlab standalone application that our customers can run with the MCR library. We want to give these customers the ability to write their own (M) code that can be executed using "eval" inside the deployed application. Everything works fine, unless they start using their own m functions that are not compiled with the application.
I know that m files cannot be used by eval in a deployed application unless they are compiled by the matlab compiler previously.
So I was wondering if it is possible to compile a M-function, and load it at runtime in the deployed application? I don't want to (and can't) link all of the user functions of our customers into the main application, but if the customer could compile his own functions, could it be loaded in the standalone application at runtime?

Best Answer

If you require the ability to create MATLAB code for dynamic run time processing, your end users must have an installed copy of MATLAB. Deployable MATLAB files are suspended or frozen at the time MATLAB Compiler encrypts them—they do not change from that point onward. The MCR only works on MATLAB code that was encrypted when the component was built. Any function or process that dynamically generates new MATLAB code will not work against the MCR.