Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
function whose argument is a string containing name of respective function.
조회 수: 2 (최근 30일)
이전 댓글 표시
I have simple question:
function m=forexample('hey')
Above, 'hey' is string containing name of the respective function. How can I evaluate respective function 'hey' in main function? They say, function feval might be useful, but i dont know how to use it...
댓글 수: 1
Stephen23
2018년 11월 14일
As an alternative, function handles are reccomended for passing functions as arguments:
답변 (1개)
James Tursa
2018년 11월 14일
편집: Stephen23
2018년 11월 14일
E.g.,
>> sind(30)
ans =
0.5000
>> s = 'sind';
>> feval(s,30)
ans =
0.5000
So, if you pass an argument into your forexample function, simply use that argument as the first argument to feval.
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!