How do you use the function eval?
Show older comments
how would you plug in 2 variables which both contain a 2x1 matrix?
3 Comments
James Tursa
on 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
on 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.
Accepted Answer
More Answers (0)
Categories
Find more on Common Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!