The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Invoke M-File dynamically in MATLAB standalone
Replies: 1   Last Post: Feb 14, 2013 2:42 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 18,038
Registered: 12/7/04
Re: Invoke M-File dynamically in MATLAB standalone
Posted: Feb 14, 2013 2:42 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Jens " <> wrote in message
> 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.

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
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.