Converting a string containing a function (t) to a useable variable.
Show older comments
I'm using inputdlg to take user input and calculate and store the value.
This is what I was trying to do.
x = inputdlg('Enter Mathematical Equation')
t = [0:0.001:20]
z = str2double (x{1})
I need to be able to enter 20*cos(4*t) for instance and have the calculated result stored in the variable, but I can't seem to get any result or for matlab to recognize the variable entered even if its declared prior to the inputdlg. Simply arguments like 20*cos(20) properly converts and calculates. How would I go on about being able to use the function from the string.
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Conversion 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!