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

2 vues (au cours des 30 derniers jours)
Pouya Jamali
Pouya Jamali le 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?

Réponse acceptée

Walter Roberson
Walter Roberson le 23 Oct 2011
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.

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by