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.

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 4월 25일
편집: Azzi Abdelmalek 2014년 4월 25일

3 개 추천

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

댓글 수: 3

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Cell Arrays에 대해 자세히 알아보기

질문:

2014년 4월 25일

댓글:

2022년 1월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by