What would you do?
이전 댓글 표시
Suppose you have a string like
rhs = 'x*cos(x)/(t+1)';
and that you want to create a function handle... would you do
fHandle = str2func(['@(t,x)',rhs])
or
fHandle = eval(['@(t,x)',rhs]);
or
?
Can you explain why?
채택된 답변
추가 답변 (1개)
Shashank Prasanna
2013년 7월 3일
1 개 추천
Don't use eval - EVER!
There is a whole documentation page that should answer 'why?'
카테고리
도움말 센터 및 File Exchange에서 Data Type Identification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!