www.pudn.com > Closid30.rar > CLVIEWEV.M, change:1997-06-17,size:24249b


function clviewev(what,opt) 
 
% Syntax: clviewev(what,opt) 
% Purpose: Changes the figures from the evaluation  
%  methods if a menu option is changed. 
% Inputs 
% what:   'option', opt=1 auto range 
%                   opt=2 set axes limits 
%                   opt=3 frequency range  
%                   opt=4 step response 
%                   opt=5 impulse response 
%                   opt=6 number of lags 
%                   opt=7 signal plot 
%                   opt=8 error plot  
%         'style',  opt=1 grid 
%                   opt=2 zoom 
%                   opt=3 freq (rad/sec) 
%                   opt=4 freq (Hz.)  
%                   opt=5 loglog scale 
%                   opt=6 linear scale 
%                   opt=7 unit circle 
%                   opt=8 re/im axes    
%        'channel', opt=1 r1 -> u  
%                   opt=2 r2 -> u 
%                   opt=3 r1 -> y 
%                   opt=4 r2 -> y 
%                   opt=5 [r1 r2] -> [y u] amplitude 
%                   opt=6 [r1 r2] -> [y u] phase 
%                   opt=7 e1 -> u  
%                   opt=8 e1 -> y 
 
% 09-06-1997 
% (c) Edwin van Donkelaar, Paul Van den Hof 
% Mechanical Engineering Systems and Control Group 
% Delft University of Technology 
% Last update: 12-06-1997 
% 
%************************************************************************** 
 
 
% Colors 
[frmcol,txtcol,edicol,pshcol,radcol,axscol,c7,c8,c9,c10,... 
modcol,edtcol,pubcol,putcol,chbcol,chtcol,txbcol,pstcol]=clsetcol; 
 
%***************************************************************** 
% 
% Option 
% 
%***************************************************************** 
if strcmp(what,'option') 
%***************************************************************** 
% Auto range 
%***************************************************************** 
  if opt==1 
   fignum=gcf; 
   ch=get(fignum,'children'); 
   ax=findobj(ch,'type','axes');  
   nax=length(ax); 
   if nax==1 
       axis;  
   elseif nax==2 
      for i=1:nax  
        subplot(2,1,i),axis; 
      end  
   elseif nax==4 
      for i=1:nax  
        subplot(2,2,i),axis; 
      end 
   end   
%*****************************************************************   
% Set axes limits 
%***************************************************************** 
  elseif opt==2 
   fignum=gcf; 
   ch=get(fignum,'children'); 
   ax=findobj(ch,'type','axes');  
   nax=length(ax);    
   % Sizes of buttons, editables et al. 
   xall=400;ybutfr=50; xbut=150;ybut=20; 
            yaxfr=50; 
   xtxtfr=150;xedit=200; 
   posfig=[593   332   xall   ybutfr+nax*yaxfr]; 
   % Make figure 
   
  if ~isempty(findobj(0,'tag','figaxlim')) 
   figure(findobj(0,'tag','figaxlim')) 
   return 
  else 
   figaxlim=figure('name','Set axes limits',... 
          'numbertitle','off','pos',posfig,'color',c7,... 
          'menubar','none','DefaultAxesColor',frmcol,... 
          'DefaultAxesFontsize',10,'tag','figaxlim');  
  end 
% Number of axes =1  
   if nax==1 
    % Get the current axes limits 
     figure(fignum) 
     xylim=[get(gca,'xlim') get(gca,'ylim')]; 
     xylim1=['[',num2str(xylim(1)),'  ',num2str(xylim(2)),'  ',num2str(xylim(3)),'  ',num2str(xylim(4)),']']; 
    % Make text and editable frames       
     txt1=uicontrol(figaxlim,'style','text','pos',[10 ybutfr+10 xtxtfr 20 ],... 
                   'string','Set axis for plot');    
     edit1=uicontrol(figaxlim,'style','edit','pos',[10+xtxtfr ybutfr+10 xedit 20 ],... 
                   'string',xylim1,'Back',edicol,'Fore',edtcol);    
   % Store handles of the evaluation figure and the editables in userdata van de figuur 
    figure(figaxlim) 
    set(figaxlim,'userdata',[fignum edit1]) 
   % Make the apply and close button 
   butapp=uicontrol(figaxlim,'style','push','pos',[10 10 xbut ybut],'string','apply'); 
   butclose=uicontrol(figaxlim,'style','push','pos',[xall-xbut-10 10 xbut ybut],'string','close'); 
   % Set callbacks for the buttons 
   set(butclose,'callback','close(gcf)') 
   callb=... 
    ['userd=get(gcf,''userdata'');',... 
     'ax=eval(get(userd(2),''string''));figure(userd(1)),axis(ax);',... 
     'clear userd ax']; 
   set(butapp,'callback',callb) 
 
% Number of axes =2  
   elseif nax==2 
    % Get the current axes limits 
     figure(fignum) 
     sub1=subplot(2,1,1);xylim=[get(gca,'xlim') get(gca,'ylim')]; 
     xylim1=['[',num2str(xylim(1)),'  ',num2str(xylim(2)),'  ',num2str(xylim(3)),'  ',num2str(xylim(4)),']']; 
     sub2=subplot(2,1,2); xylim=[get(gca,'xlim') get(gca,'ylim')]; 
     xylim2=['[',num2str(xylim(1)),'  ',num2str(xylim(2)),'  ',num2str(xylim(3)),'  ',num2str(xylim(4)),']']; 
 
    % Make text and editable frames       
     txt2=uicontrol(figaxlim,'style','text','pos',[10 ybutfr+10 xtxtfr 20 ],... 
                   'string','Set axis subplot(2,1,2)');    
     edit2=uicontrol(figaxlim,'style','edit','pos',[10+xtxtfr ybutfr+10 xedit 20 ],... 
                   'string',xylim2,'Back',edicol,'Fore',edtcol);    
     txt1=uicontrol(figaxlim,'style','text','pos',[10 10+ybutfr+yaxfr xtxtfr 20 ],... 
                   'string','Set axis subplot(2,1,1)');    
     edit1=uicontrol(figaxlim,'style','edit','pos',[10+xtxtfr 10+ybutfr+yaxfr xedit 20 ],... 
                  'string',xylim1,'Back',edicol,'Fore',edtcol);    
  
   % Store handles of the evaluation figure and the editables in userdata van de figuur 
    figure(figaxlim) 
    set(figaxlim,'userdata',[fignum edit1 edit2]) 
 
   % Make the apply and close button 
   butapp=uicontrol(figaxlim,'style','push','pos',[10 10 xbut ybut],'string','apply'); 
   butclose=uicontrol(figaxlim,'style','push','pos',[xall-xbut-10 10 xbut ybut],'string','close'); 
 
   % Set callbacks for the buttons 
   set(butclose,'callback','close(gcf)') 
   callb=... 
    ['userd=get(gcf,''userdata'');',... 
     'ax=eval(get(userd(2),''string''));figure(userd(1)),subplot(2,1,1),axis(ax);',... 
     'ax=eval(get(userd(3),''string''));figure(userd(1)),subplot(2,1,2),axis(ax);',... 
     'clear userd ax']; 
   set(butapp,'callback',callb) 
 
% Number of axes =4  
   elseif nax==4 
    % Get the current axes limits 
     figure(fignum) 
     sub1=subplot(2,2,1);xylim=[get(gca,'xlim') get(gca,'ylim')]; 
     xylim1=['[',num2str(xylim(1)),'  ',num2str(xylim(2)),'  ',num2str(xylim(3)),'  ',num2str(xylim(4)),']']; 
     sub2=subplot(2,2,2);xylim=[get(gca,'xlim') get(gca,'ylim')]; 
     xylim2=['[',num2str(xylim(1)),'  ',num2str(xylim(2)),'  ',num2str(xylim(3)),'  ',num2str(xylim(4)),']']; 
     sub3=subplot(2,2,3);xylim=[get(gca,'xlim') get(gca,'ylim')]; 
     xylim3=['[',num2str(xylim(1)),'  ',num2str(xylim(2)),'  ',num2str(xylim(3)),'  ',num2str(xylim(4)),']']; 
     sub4=subplot(2,2,4);xylim=[get(gca,'xlim') get(gca,'ylim')]; 
     xylim4=['[',num2str(xylim(1)),'  ',num2str(xylim(2)),'  ',num2str(xylim(3)),'  ',num2str(xylim(4)),']']; 
 
    % Make text and editable frames       
     txt4=uicontrol(figaxlim,'style','text','pos',[10 ybutfr+10 xtxtfr 20 ],... 
                   'string','Set axis subplot (2,2,4)');    
     edit4=uicontrol(figaxlim,'style','edit','pos',[10+xtxtfr ybutfr+10 xedit 20 ],... 
                   'string',xylim4,'Back',edicol,'Fore',edtcol);    
     txt3=uicontrol(figaxlim,'style','text','pos',[10 10+ybutfr+yaxfr xtxtfr 20 ],... 
                   'string','Set axis subplot (2,2,3)');    
     edit3=uicontrol(figaxlim,'style','edit','pos',[10+xtxtfr 10+ybutfr+yaxfr xedit 20 ],... 
                   'string',xylim3,'Back',edicol,'Fore',edtcol);    
     txt2=uicontrol(figaxlim,'style','text','pos',[10 10+ybutfr+2*yaxfr xtxtfr 20 ],... 
                   'string','Set axis subplot (2,2,2)');    
     edit2=uicontrol(figaxlim,'style','edit','pos',[10+xtxtfr 10+ybutfr+2*yaxfr xedit 20 ],... 
                   'string',xylim2,'Back',edicol,'Fore',edtcol);    
     txt1=uicontrol(figaxlim,'style','text','pos',[10 10+ybutfr+3*yaxfr xtxtfr 20 ],... 
                   'string','Set axis subplot (2,2,1)');    
     edit1=uicontrol(figaxlim,'style','edit','pos',[10+xtxtfr 10+ybutfr+3*yaxfr xedit 20 ],... 
                   'string',xylim1,'Back',edicol,'Fore',edtcol);    
 
   % Store handles of the evaluation figure and the editables in userdata van de figuur 
    figure(figaxlim) 
    set(figaxlim,'userdata',[fignum edit1 edit2 edit3 edit4]) 
   % Make apply and close button 
   butapp=uicontrol(figaxlim,'style','push','pos',[10 10 xbut ybut],'string','apply'); 
   butclose=uicontrol(figaxlim,'style','push','pos',[xall-xbut-10 10 xbut ybut],'string','close'); 
   % Set callbacks for the buttons 
   set(butclose,'callback','close(gcf)') 
   callb=... 
    ['userd=get(gcf,''userdata'');',... 
     'ax=eval(get(userd(2),''string''));figure(userd(1)),subplot(2,2,1),axis(ax);',... 
     'ax=eval(get(userd(3),''string''));figure(userd(1)),subplot(2,2,2),axis(ax);',... 
     'ax=eval(get(userd(4),''string''));figure(userd(1)),subplot(2,2,3),axis(ax);',... 
     'ax=eval(get(userd(5),''string''));figure(userd(1)),subplot(2,2,4),axis(ax);',... 
     'clear userd ax']; 
   set(butapp,'callback',callb) 
   end            
%***************************************************************** 
% Set frequency range 
%***************************************************************** 
  elseif opt==3   
   fignum=gcf; 
  % Find out which evaluation method: closed-loop or open-loop 
   if strcmp(get(gcf,'tag'),'CLTFFIG') 
    option=1; 
   elseif strcmp(get(gcf,'tag'),'OLTFFIG') 
    option=6; 
   else 
    option=0; % Controller view 
   end 
  % Make figure if necessary 
   if ~isempty(findobj(0,'tag','figflim')) 
    figure(findobj(0,'tag','figflim')) 
    return 
   else 
     % Sizes of figure, buttons, editables et al. 
      xall=400;ybutfr=50; xbut=150;ybut=20; 
            yaxfr=50; 
      xtxtfr=150;xedit=200; 
      posfig=[593   332   xall   ybutfr+yaxfr];  
     % Make figure 
      figflim=figure('name','Set frequency range',... 
           'numbertitle','off','pos',posfig,'color',c7,... 
           'menubar','none','DefaultAxesColor',frmcol,... 
           'DefaultAxesFontsize',10,'tag','figflim');  
     % Make text and editable frames       
      txt1=uicontrol(figflim,'style','text','pos',[10 ybutfr+10 xtxtfr 20 ],... 
                    'string','Give frequency vector');    
      edit1=uicontrol(figflim,'style','edit','pos',[10+xtxtfr ybutfr+10 xedit 20 ],... 
                   'string','logspace(-3,pi)','Back',edicol,'Fore',edtcol);    
     % Store handles of the evaluation figure and the editables  
     % and the index of the evaluation method in the userdata of de figure. 
      figure(figflim) 
      set(figflim,'userdata',[fignum edit1 option]) 
     % Make apply and close button 
      butapp=uicontrol(figflim,'style','push','pos',[10 10 xbut ybut],'string','apply'); 
      butclose=uicontrol(figflim,'style','push','pos',[xall-xbut-10 10 xbut ybut],'string','close'); 
     % Set callback for the close button 
      set(butclose,'callback','close(gcf)') 
     % Set callback for the apply button 
     if option==1|option==6 
      callb=['us=get(gcf,''userdata'');',... 
        'us1=get(us(1),''userdata'');',... 
        'omx=eval(get(us(2),''string''));',...         
        'omz=zeros(length(omx),1);',... 
        'omz(:)=omx;',...  
        'set(us(1),''userdata'',[us1(1,1);omz]);',... 
        'figure(us(1));',... 
        'clplotev(us(3),''all'');',... 
        'clear us us1 omx omz'];         
      elseif option==0 
      callb=['us=get(gcf,''userdata'');',... 
        'us1=get(us(1),''userdata'');',... 
        'omx=eval(get(us(2),''string''));',...         
        'omz=zeros(length(omx),1);',... 
        'omz(:)=omx;',...  
        'set(us(1),''userdata'',omz);',... 
        'figure(us(1));',... 
        'cldcplot(''fc'');',... 
        'clear us us1 omx omz'];         
      end 
      set(butapp,'callback',callb) 
 
   end  
%***************************************************************** 
% Step response  
%***************************************************************** 
  elseif opt==4 
   fignum=gcf; 
   h1=findobj(fignum,'label','Step response'); 
   h2=findobj(fignum,'label','Impulse response'); 
   if strcmp(get(h1,'checked'),'on') 
     % No action taken 
   else 
     set(h2,'checked','off'),set(h1,'checked','on') 
   end   
   % Calculate and plot  
   clplotev(5,'all')  
   
%***************************************************************** 
% Impulse response  
%***************************************************************** 
  elseif opt==5 
   fignum=gcf; 
   h1=findobj(fignum,'label','Step response'); 
   h2=findobj(fignum,'label','Impulse response'); 
   if strcmp(get(h2,'checked'),'on') 
     % No action taken 
   else 
     set(h1,'checked','off'),set(h2,'checked','on') 
   end   
   % Calculate and plot  
   clplotev(5,'all')  
%***************************************************************** 
%  Number of lags 
%***************************************************************** 
  elseif opt==6 
   fignum=gcf; 
   % Find out which evaluation method: closed-loop step response or correlation test 
   if strcmp(get(gcf,'tag'),'CLCORFIG') 
    option=4; 
   elseif strcmp(get(gcf,'tag'),'CLSTFIG') 
    option=5; 
   end  
 
  % Make figure if necessary 
   if ~isempty(findobj(0,'tag','figflim')) 
    figure(findobj(0,'tag','figflim')),return 
   else 
     % Sizes of figure, buttons, editables et al. 
      xall=300;ybutfr=50; xbut=125;ybut=20; 
            yaxfr=50; 
      xtxtfr=150;xedit=100; 
      posfig=[593   332   xall   ybutfr+yaxfr];  
     % Make figure 
      figflim=figure('name','Give number of lags',... 
           'numbertitle','off','pos',posfig,'color',c7,... 
           'menubar','none','DefaultAxesColor',frmcol,... 
           'DefaultAxesFontsize',10,'tag','figflim');  
     % Make text and editable frames       
      txt1=uicontrol(figflim,'style','text','pos',[10 ybutfr+10 xtxtfr 20 ],... 
                    'string','Give number of lags');    
      edit1=uicontrol(figflim,'style','edit','pos',[10+xtxtfr ybutfr+10 xedit 20 ],... 
                   'string','100','Back',edicol,'Fore',edtcol);    
     % Store handles of the evaluation figure and the editables  
     % and the index of the evaluation method in the userdata of de figure. 
      figure(figflim) 
      set(figflim,'userdata',[fignum edit1 option]) 
     % Make apply and close button 
      butapp=uicontrol(figflim,'style','push','pos',[10 10 xbut ybut],'string','apply'); 
      butclose=uicontrol(figflim,'style','push','pos',[xall-xbut-10 10 xbut ybut],'string','close'); 
     % Set callback for the close button 
      set(butclose,'callback','close(gcf)') 
     % Set callback for the apply button 
      callb=['us=get(gcf,''userdata'');',... 
        'us1=get(us(1),''userdata'');',... 
        'N=eval(get(us(2),''string''));',...         
        'set(us(1),''userdata'',[us1(1,1);N]);',... 
        'figure(us(1));',... 
        'clplotev(us(3),''all'');',... 
        'clear us us1 N'];         
      set(butapp,'callback',callb) 
   end  
%***************************************************************** 
% Signal plot 
%***************************************************************** 
  elseif opt==7 
   fignum=gcf; 
   h1=findobj(fignum,'label','Signal plot'); 
   h2=findobj(fignum,'label','Error plot'); 
   if strcmp(get(h1,'checked'),'on') 
     % No action taken 
   else 
     set(h2,'checked','off'),set(h1,'checked','on') 
   end   
   % Calculate and plot  
   clplotev(3,'all')  
   
%***************************************************************** 
% Error plot  
%***************************************************************** 
  elseif opt==8 
   fignum=gcf; 
   h1=findobj(fignum,'label','Signal plot'); 
   h2=findobj(fignum,'label','Error plot'); 
   if strcmp(get(h2,'checked'),'on') 
     % No action taken 
   else 
     set(h1,'checked','off'),set(h2,'checked','on') 
   end   
   % Calculate and plot  
   clplotev(3,'all')  
 
 
  end 
 
%***************************************************************** 
% 
% Style 
% 
%***************************************************************** 
elseif strcmp(what,'style') 
%***************************************************************** 
% Toggle beteen grids 
%***************************************************************** 
  if opt==1 
   fignum=gcf; 
   ch=get(fignum,'children'); 
   ax=findobj(ch,'type','axes');  
   nax=length(ax); 
   if nax==1 
      grid   
   elseif nax==2 
     for i=1:nax  
      subplot(2,1,i),grid 
     end  
   elseif nax==4 
     for i=1:nax  
      subplot(2,2,i),grid 
     end 
   end       
  h=findobj(fignum,'label','Grid'); 
  if strcmp(get(h,'checked'),'on') 
   set(h,'checked','off')  
  elseif strcmp(get(h,'checked'),'off') 
   set(h,'checked','on') 
  end 
%***************************************************************** 
% Toggle beteen zoom 
%***************************************************************** 
  elseif opt==2 
   fignum=gcf; 
   h=findobj(fignum,'label','Zoom'); 
   if strcmp(get(h,'checked'),'on') 
    zoom off 
    set(h,'checked','off')  
   elseif strcmp(get(h,'checked'),'off') 
    zoom on 
    set(h,'checked','on') 
   end 
% Frequency (rad/sec) 
  elseif opt==3 
   fignum=gcf; 
   ch=get(fignum,'children'); 
   ax=findobj(ch,'type','axes');  
   nax=length(ax);     
   h1=findobj(fignum,'label','Frequency (rad/sec)'); 
   h2=findobj(fignum,'label','Frequency (Hz)'); 
   if strcmp(get(h1,'checked'),'off') 
   %     set(h1,'checked','on') 
   %     set(h2,'checked','off')     
   %     for i=1:nax 
   %       ytick=get(ax(i),'ytick'); 
   %       set(ax(i),'ytick',ytick*2*pi)   
   end    
  %  
%***************************************************************** 
% Log amplitude scale  
%***************************************************************** 
  elseif opt==5 
   fignum=gcf; 
   ch=get(fignum,'children'); 
   ax=findobj(ch,'type','axes');  
   nax=length(ax);     
   h1=findobj(fignum,'Label','Log amplitude scale'); 
   h2=findobj(fignum,'Label','Linear amplitude scale'); 
   if strcmp(get(h1,'checked'),'off') 
     set(h1,'checked','on') 
     set(h2,'checked','off')     
     if nax==4 
      for i=1:nax 
        set(ax(i),'yscale','log')  
      end         
     elseif nax==2 
      h=subplot(2,1,1);set(h,'yscale','log') 
     end 
   end 
%***************************************************************** 
% Linear scale 
%***************************************************************** 
  elseif opt==6 
   fignum=gcf; 
   ch=get(fignum,'children'); 
   ax=findobj(ch,'type','axes');  
   nax=length(ax);     
   h1=findobj(fignum,'label','Log amplitude scale'); 
   h2=findobj(fignum,'label','Linear amplitude scale'); 
   if strcmp(get(h2,'checked'),'off') 
     set(h2,'checked','on') 
     set(h1,'checked','off')     
     for i=1:nax 
      set(ax(i),'yscale','lin')      
     end 
   end 
%***************************************************************** 
% Unit circle  
%***************************************************************** 
  elseif opt==7 
   fignum=gcf; 
   h1=findobj(fignum,'label','Unit circle'); 
   uc=findobj(fignum,'TAG','UNITCIRCLE') ; 
   if strcmp(get(h1,'checked'),'on') 
     set(uc,'visible','off') 
     set(h1,'checked','off') 
   elseif strcmp(get(h1,'checked'),'off') 
     set(uc,'visible','on') 
     set(h1,'checked','on') 
   end         
  end 
 
 
%***************************************************************** 
% 
% Channel 
% 
%***************************************************************** 
 
elseif strcmp(what,'channel') 
  fignum=gcf; 
  chanitem=findobj(fignum,'label','Channel'); 
  chanhand=get(chanitem,'userdata'); 
  us=get(fignum,'userdata'); 
 
 % Find out which evaluation method: closed-loop transfer or closed-loop transfer 
  if strcmp(get(gcf,'tag'),'CLTFFIG') 
   option=1; 
  elseif strcmp(get(gcf,'tag'),'CLPOFIG') 
   option=2; 
  elseif strcmp(get(gcf,'tag'),'CLIOFIG') 
   option=3; 
  elseif strcmp(get(gcf,'tag'),'CLCORFIG') 
   option=4; 
  elseif strcmp(get(gcf,'tag'),'CLSTFIG') 
   option=5; 
  elseif strcmp(get(gcf,'tag'),'OLTFFIG') 
   option=6; 
  elseif strcmp(get(gcf,'tag'),'OLPOFIG') 
   option=7; 
  end 
 
 % Deal with the different channels 
%***************************************************************** 
% r1 -> u 
%***************************************************************** 
  if opt==1 
    if us(1,1)==1 
      % No action undertaken 
    else      
     % Set user data with regard to the channel right  
     set(chanhand(us(1,1)),'checked','off') 
     set(chanhand(1),'checked','on'),us(1,1)=1; 
     set(fignum,'userdata',us); 
     % Calculate and plot  
     clplotev(option,'all')  
    end 
%***************************************************************** 
% r1 -> y 
%***************************************************************** 
  elseif opt==2 
    if us(1,1)==2 
      % No action undertaken 
    else      
     % Set user data with regard to the channel right  
     set(chanhand(us(1,1)),'checked','off') 
     set(chanhand(2),'checked','on'),us(1,1)=2; 
     set(fignum,'userdata',us); 
     % Calculate and plot  
     clplotev(option,'all')  
    end 
%***************************************************************** 
% r2 -> u 
%***************************************************************** 
  elseif opt==3 
    if us(1,1)==3 
      % No action undertaken 
    else      
     % Set user data with regard to the channel right  
     set(chanhand(us(1,1)),'checked','off') 
     set(chanhand(3),'checked','on'),us(1,1)=3; 
     set(fignum,'userdata',us); 
     % Calculate and plot  
     clplotev(option,'all')  
    end 
%***************************************************************** 
% r2 -> y 
%***************************************************************** 
  elseif opt==4 
    if us(1,1)==4 
      % No action undertaken 
    else      
     % Set user data with regard to the channel right  
     set(chanhand(us(1,1)),'checked','off') 
     set(chanhand(4),'checked','on'),us(1,1)=4; 
     set(fignum,'userdata',us); 
     % Calculate and plot  
     clplotev(option,'all')  
    end      
%***************************************************************** 
% [r1 r2] -> [y u] amplitude 
%***************************************************************** 
  elseif opt==5 
    if us(1,1)==5 
      % No action undertaken 
    else 
     % Set user data with regard to the channel right  
      set(chanhand(us(1,1)),'checked','off') 
      set(chanhand(5),'checked','on'),us(1,1)=5; 
      set(fignum,'userdata',us); 
     % Calculate and plot 
     clplotev(option,'all')  
    end 
%***************************************************************** 
% [r1 r2] -> [y u] phase 
%***************************************************************** 
  elseif opt==6 
    if us(1,1)==6 
      % No action undertaken 
    else      
     % Set user data with regard to the channel right and swith checked marks 
     set(chanhand(us(1,1)),'checked','off') 
     set(chanhand(6),'checked','on'),us(1,1)=6; 
     set(fignum,'userdata',us); 
     % Calculate and plot  
     clplotev(option,'all')  
    end 
%***************************************************************** 
% e1 -> u 
%***************************************************************** 
  elseif opt==7 
    if us(1,1)==7 
      % No action undertaken 
    else      
     % Set user data with regard to the channel right and swith checked marks 
     set(chanhand(us(1,1)),'checked','off') 
     set(chanhand(7),'checked','on'),us(1,1)=7; 
     set(fignum,'userdata',us); 
     % Calculate and plot  
     clplotev(option,'all')  
    end  
%***************************************************************** 
% e1 -> y 
%***************************************************************** 
  elseif opt==8  
    if us(1,1)==8 
      % No action undertaken 
    else      
     % Set user data with regard to the channel right and swith checked marks 
     set(chanhand(us(1,1)),'checked','off') 
     set(chanhand(8),'checked','on'),us(1,1)=8; 
     set(fignum,'userdata',us); 
     % Calculate and plot  
     clplotev(option,'all')  
    end 
  end  
end