What would you do?
Mostra commenti meno recenti
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?
Risposta accettata
Più risposte (1)
Shashank Prasanna
il 3 Lug 2013
1 voto
Don't use eval - EVER!
There is a whole documentation page that should answer 'why?'
1 Commento
Kye Taylor
il 8 Lug 2013
Categorie
Scopri di più su Data Type Identification in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!