Converting a string containing a function (t) to a useable variable.
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Type Conversion 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!