No BSD License  

Highlights from
Numerical Analysis and Graphic Visualization with MATLAB

guidm_1.m
%GuiDm_1.m  Illustrates user interface menu.
% Copyright S. Nakamura, 1995
close, clear
figure(1)
set(gcf,'Position',[100,300,300,220],...
   'Color', [0.5, 0.5, 0.2], ...
   'NumberTitle','off',...
   'Name','GuiDm_1')
x=0:0.1:10;, y=sin(x);
p=plot(x,y);xlabel('x');ylabel('y=sin(x)');
stl = uimenu(gcf,...
     'Label','   Line Style',...
     'BackGroundColor',[0.8, 0.0, 0.8],...
     'Position',2);
clr = uimenu(gcf,...
     'Label','   Line Color',...
     'BackGroundColor',[0.8, 0.8, 0.8],...
     'Position',1);
lw = uimenu(gcf,...
     'Label','   Line width',...
     'BackgroundColor',[0.8, 0.8, 0.8],...
     'Position',3);
solid = uimenu(stl, ...
     'Label', 'Solid',...
     'CallBack','set(p,''LineStyle'',''-'')');
dotted = uimenu(stl, ...
     'Label', 'Dotted',...
     'CallBack','set(p,''LineStyle'','':'')');
yellow = uimenu(clr,...
     'Label', 'Yellow',...
     'BackgroundColor',[0.9, 0.9, 0.1],...
     'CallBack','set(p,''Color'',''y'')');
green = uimenu(clr, ...
     'Label','Green',...
     'BackgroundColor',[0.1, 0.9, 0.1],...
     'CallBack','set(p,''Color'',''g'')');
red = uimenu(clr,...
     'Label', 'Red',...
     'BackgroundColor',[0.9, 0.1 , 0.1],...
     'CallBack','set(p,''Color'',''r'')');
solid = uimenu(lw, ...
     'Label', '0.5',...
     'CallBack','set(p,''LineWidth'',0.5)');
dotted = uimenu(lw, ...
     'Label', '3.0',...
     'CallBack','set(p,''LineWidth'',1.0)');

Contact us at files@mathworks.com