You can also use ezplot
:
ezplot(get(hObject,'String'));
Question
What I am trying to do is that when I put into "Edit text" (called: funkcia_edit
) some function it will draw me graf to that function. Here is picture what I am trying to do, as you can see I have declared variables X and Y where Y is standing for funkcia_edit
= x.^2
and then I want to plot(x,y). Can any one help me how to make it work?
Thanks
Solution 2
You can also use ezplot
:
ezplot(get(hObject,'String'));
OTHER TIPS
I think what you're missing is the eval function in Matlab. If I'm not mistaken what you want to do is
y = eval(get(hObject,'String'));
Observe that while this is probably the easiest way of programming this functinality in MATLAB it is not necessary the safest. A user could write system('rm -rf *')
and your program will evaluate that.