How do you use the function eval?
Mostrar comentarios más antiguos
how would you plug in 2 variables which both contain a 2x1 matrix?
3 comentarios
James Tursa
el 22 de Nov. de 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
el 22 de Nov. de 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.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Common Operations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!