I am making a program which allows for user input of different functions. I made a dialog box with inputdlg, but the result was a string and I cant figure out how to evaluate the given function numerically.
This is the input part of the code so far. What am I doing wrong?
func=inputdlg('Input Function: y=') func1=str2num(func)
I have also tried using eval()
func=inputdlg('Input Function: y=') func1=eval(func)
My goal is that when someone inputs sin(x), the result is func='sin(x)' and func1 is sin(x) evaluated for the x-values.
Thanks!
Best Answer