Date: Feb 14, 2013 2:42 PM
Author: Steven Lord
Subject: Re: Invoke M-File dynamically in MATLAB standalone



"Jens " <alpha60@freenet.de> wrote in message
news:kfj7du$hog$1@newscl01ah.mathworks.com...
> Dear all,
>
> i just want to know if it is possible to invoke Matlab scripts or function
> within an m-file dynamically into an existing standalone tool, which is
> compiled with the deploymenttool of MATLAB itself?


You mean run a script or function that was NOT compiled into the application
but was created or specified later? No, this is not possible.

http://www.mathworks.com/help/compiler/writing-deployable-matlab-code.html

As that page says, if you want (for example) your application's users to be
able to run myfunction1 or myfunction2 based on the choices they make at
runtime, you need to include both myfunction1 and myfunction2 in your
deployed application when it is created. You cannot include myfunction1 but
let the user create myfunction2 and somehow make it available to the
application at runtime.


If you mean you want to create functions myfunction1, myfunction2,
myfunction3, ... myfunction1000 and let the user choose which to invoke
without explicitly writing all 1000 different calls, I believe that should
be possible by explicitly including the functions in the application then
using STR2FUNC to generate a function handle that is then called like any
other function handle. [Personally I'd almost certainly make ONE function
that accepts a number between 1 and 1000 rather than having 1000 individual
functions, but your use case may differ.]

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com