Hi;
i have a code which evaluates a function "f". but i want to take this "f" as input.
it is like;
f=@ input('please enter the predefined function name')
but this is not valid. is any way to do this ? thanks.

 Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 25 Avr 2014
Modifié(e) : Azzi Abdelmalek le 25 Avr 2014
Use str2func function
str=input('your function','s')
f=str2func(str)

3 commentaires

dila
dila le 25 Avr 2014
Yes the exact solution.. Thank you.
Razan alhammad
Razan alhammad le 10 Avr 2020
how i put it value in this function because also i have mistake when i put it variable in f(..)
how to give arguement?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by