%A very simple function plotter to demo GUI building:
%--pushbuttons
%--static/editable text fields
%--drawing axes

clf
clear all

%action when 'plot' button is pressed
plt_callbk_str=...
   ['x=str2num(get(xrange,''string''));'...
      'y=eval(get(fucfield,''string''));'...
      'plot(x,y);'];

%define the plot button
plotbutton=uicontrol('style','pushbutton',...
   'string','plot', ...
   'fontsize',12, ...
   'position',[100,400,50,20], ...
   'callback', plt_callbk_str);

%define the erase button
erasebutton=uicontrol('style','pushbutton',...
   'string','erase', ...
   'fontsize',12, ...
   'position',[200,400,50,20], ...
   'callback','cla');

%define the function editable text field
fucfield=uicontrol('style','edit',...
   'string','abs(sin(2*pi*x))', ...
   'fontsize',12, ...
   'position',[220,1,300,20] ...
   );

%define the x range editable text field
x=-1:.01:1;
xrange=uicontrol('style','edit',...
   'string','-1:.01:1', ...
   'fontsize',12, ...
   'position',[100,1,100,20] ...
   );

%define some static text
uicontrol('style','text',...
   'string','x-range=',...
   'fontsize',12, ...
   'position',[40,1,60,20]);