MATLAB: Function entering and plotimg

plot

hey, i want to input a function of t(time) in my edit text box.then i want this function to be plotted with respect to time in the axes.how can i do that.

Best Answer

Here is another.
function [] = plot_ex()
% Help goes here.
S.fh = figure('units','pixels',...
'position',[200 300 420 420],...
'menubar','none',...
'name','plot_ex',...
'numbertitle','off',...
'resize','off');
S.ax = axes('units','pix',...
'position',[40 90 360 290]);
S.pb = uicontrol('style','push',...
'unit','pix',...
'position',[280 20 120 25],...
'string','push2plot',...
'callback',@pp_call,...
'fontweight','bold',...
'fontsize',12);
S.ed = uicontrol('style','edit',...
'unit','pix',...
'string','4*t^2*cos(t)',...
'position',[40 20 220 25]);
guidata(S.fh,S)
uicontrol(S.ed)
function [] = pp_call(varargin)
% Callback for the pushbutton.
S = guidata(gcbf);
ezplot(get(S.ed,'string'))