MATLAB Answers

pouya jamali

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?



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

Thank you Walter

Join the 15-year community celebration.

Play games and win prizes!

Learn more
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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!