MATLAB: How to take a function to handle as input

function handle input

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.

Best Answer

Use str2func function
str=input('your function','s')
f=str2func(str)