How do you use the function eval?
Mostra commenti meno recenti
how would you plug in 2 variables which both contain a 2x1 matrix?
3 Commenti
James Tursa
il 22 Nov 2017
Please give more detail about the problem you are solving. Providing a short example with input(s) and desired output(s) would help as well. Usually there are better approaches than using eval( ).
Nikko Magsino
il 22 Nov 2017
@NIkko Magsino: Do NOT use eval for converting symbolic expressions to numeric, or for substituting into symbolic expressions. It is the wrong tool for the job, and whoever wrote that question gave bad advice.
Take a look at the list of Symbolic Toolbox functions:
Note that eval is not listed, but it includes the correct ways to convert to numeric, which is to use the functions double, single, int8, etc. They are clearly listed under the section title "Conversion Between Symbolic and Numeric".
This specific list of symbolic conversion functions is the same:
So whoever wrote that question is not only giving bad advice but has also never bothered to actually read the MATLAB documentation.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Common Operations 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!