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!