www.pudn.com > Closid30.rar > Clobjact.m, change:1998-09-16,size:4273b


function clobjact(option) 
% function clobjact(option) 
 
% Activates data, controller or model when the axes (option=1), 
% text/line (option=2) is clicked on, 
% and updates view/evaluation figures when appropriate. 
 
% Functions called: clplotev, cldcplot 
 
% 21-06-1996 
% (c) Edwin van Donkelaar, Douwe de Vries, Paul Van den Hof 
% Mechanical Engineering Systems and Control Group 
% Delft University of Technology 
% Last update: 13-06-1997 
%              15-09-1998, adapted to the situation of having separate 
%                          working and validation data. 
 
global CLIDmods CLIDevas CLIDmeth 
 
if option==1 
 axt=get(gca,'TAG'); 
elseif option==2 
 axt=get(gco,'TAG'); 
end 
 
% Determine type of object: 
axi=find(axt=='_')+1; 
% ix=[1 2 4], 1 data, 2 model, 4 controller 
ix=str2num(axt(axi(1):axi(2)-2)); 
% Determine object/axis ordering number 
im=str2num(axt(axi(2):length(axt))); 
ro=(ix-1)*5; 
% 
% Act only if the axes are occupied by a variable  
if CLIDmods(ro+3,im)~=1 
  return 
end 
% 
% Only allow axes toggling for controllers when 
% there is no identification window open. 
if ix==4 
  for k=1:size(CLIDmeth,2) 
	if findobj('name',CLIDmeth{k})  
      clerrdia(['ERROR: Close identification window before '... 
	         'reselecting controller'],1) 
	  return 
	end 
  end 
end 
% 
% In all other cases: activate/deactivate object that has been selected 
cm=CLIDmods(1,ix);				  % cm is maximum number of objects allowed 
ia=find(CLIDmods(ro+2,1:cm)==1);  % find active axes 
it=~CLIDmods(ro+2,im);            % toggle current axes status; it is the new status. 
if ix==2 
  param=CLIDmods(57,im); 
end 
nevas=size(CLIDevas,2); 
% 
%*************************************************************************** 
%                     Data selection/deselection handling 
%*************************************************************************** 
if ix==1 
  if it==1 
%   Deactivate old axes  
    CLIDmods(ro+2,ia)=0*ia; 
    linh=CLIDmods(ro+6,ia); 
    set(linh,'linewidth',1); 
  end 
% activate/deactivate new axes 
  linh=CLIDmods(ro+6,im); 
  set(linh,'linewidth',1+2*it); 
  CLIDmods(ro+2,im)=it; 
% Update data views and data-dependent 
% model evaluations: 
  if ~isempty(findobj('tag','DATATPLOT')) 
    cldcplot('td') 
  end 
  if ~isempty(findobj('tag','DATAFPLOT')) 
    cldcplot('fd') 
  end 
%  for k=3:4, 
%    if isempty(findobj('name',CLIDevas(k,:)))==0 
%     clplotev(k,'all') 
%    end 
%  end 
% 
%************************************************************************ 
%                  Model selection/deselection handling: 
%************************************************************************ 
elseif ix==2 
%  When activating: deactivate other models when 
%  > 1 controller is selected. 
  if it==1 & sum(CLIDmods(17,:)) > 1 
    CLIDmods(ro+2,ia)=0*ia; 
    linh=CLIDmods(ro+6,ia); 
    set(linh,'linewidth',1); 
  end 
%  Activate/deactivate new model: 
  linh=CLIDmods(ro+6,im); 
  set(linh,'linewidth',1+2*it); 
  CLIDmods(ro+2,im)=it; 
% 
%  If activated/deactivated model is parametric: 
%  update all open evaluation figures: 
  if param==1 
    for k=1:nevas, 
      if ~isempty(findobj('name',CLIDevas{k})) 
       clplotev(k,'all') 
      end 
	end 
% If act/deact model is non-parametric, update only 
% evaluation figures 1 and 6. 
  elseif param==0 
    for k=[1 6], 
	  if ~isempty(findobj('name',CLIDevas{k})) 
       clplotev(k,'all') 
	  end 
	end 
  end 
% 
%************************************************************************ 
%                  Controller selection/deselection handling: 
%************************************************************************ 
elseif ix==4 
%  When activating: deactivate other controllers when 
%  > 1 model is selected. 
  if it==1 & sum(CLIDmods(7,:)) > 1 
    CLIDmods(ro+2,ia)=0*ia; 
    linh=CLIDmods(ro+6,ia); 
    set(linh,'linewidth',1); 
  end 
%  Activate/deactivate new controller: 
  linh=CLIDmods(ro+6,im); 
  set(linh,'linewidth',1+2*it); 
  CLIDmods(ro+2,im)=it; 
%  Update controller view and controller- 
%  dependent model evaluations: 
  if ~isempty(findobj('tag','CONPLOT')) 
    cldcplot('fc') 
  end 
  for k=1:5, 
    if ~isempty(findobj('name',CLIDevas{k})) 
      clplotev(k,'all') 
    end 
  end 
end