Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit:

How to summon a function that it's name was stored in a string?

Asked by pouya jamali on 23 Oct 2011

During my program ,I want to summon a function that it's name was previously saved in a string variable ! How can I do it?


pouya jamali


No products are associated with this question.

1 Answer

Answer by Walter Roberson on 23 Oct 2011
Accepted answer

It is better to avoid doing such things if you can. Consider instead storing function handles, or using str2func.

What you are asking for is possible (and not syntactically difficult), but it gets misused much much more often than it gets used properly.

1 Comment

pouya jamali on 23 Oct 2011

Thank you Walter

Walter Roberson

Contact us