www.pudn.com > Closid30.rar > CLOBJDEL.M, change:1998-09-17,size:2088b


function clobjdel(option,check) 
% clobjdel(option) 
% 
% Deletes highlighted axes objects in the main window. 
% Options: 'data','model','contr' 
% check: parameter indicating whether a check has to be made on the allowance 
%        to delete the object (check=1) or unconditional delete (check=0) 
 
% Functions called: clsetcol 
 
% 21-06-1996 
% (c) Douwe de Vries, Paul Van den Hof 
% Mechanical Engineering Systems and Control Group 
% Delft University of Technology 
% Last update: 31-05-1997 
%              13-09-1998 Input argument 'check' added. 
%              17-09-1998 and corrected 
global CLIDmods 
 
if strcmp(option,'data') 
   ix=1; 
elseif strcmp(option,'model') 
   ix=2; 
elseif strcmp(option,'contr') 
   ix=4; 
else 
   error('not a valid option') 
end 
if nargin < 2 
  check=0; 
end 
if check~=0 & check~=1 
   error('not a valid option') 
end 
 
ro=(ix-1)*5; 
cm=[1:CLIDmods(1,ix)]; 
ia=find(CLIDmods(ro+2,cm)==1); 
 
% In the data case, check that you do not throw away working or 
% validation data: 
if ix==1 & check==1 
 if (CLIDmods(2,CLIDmods(58,1))~=0 | CLIDmods(2,CLIDmods(59,1))~=0) 
  clerrdia(['The data you selected contains working and/or validation data'],1); 
  set(findobj('tag','CLMAINPOPDATA'),'value',1) 
  return 
 else  
   clyesno('clobjdel(''data'',0);','Delete highlighted data?')  
 end 
end 
   
if check==0 
if ~isempty(ia) 
   CLIDmods(ro+2,ia)=0*ia;           % make axes inactive 
   set(CLIDmods(ro+6,ia),'linewidth',1); 
   CLIDmods(ro+3,ia)=0*ia;           % set axes to free 
   axh=CLIDmods(ro+4,ia); 
   texh=CLIDmods(ro+5,ia); 
   linh=CLIDmods(ro+6,ia); 
   set(linh,'UserData',[]); 
   set(texh,'UserData',[]); 
   set(texh,'String',''); 
   set(linh,'xdata',[],'ydata',[]); 
   set(linh,'linewidth',1); 
   frmcol=clsetcol; 
   set(axh,'color',frmcol); 
   set(linh,'vis','off'); 
end 
%  Set pop-up menu choice back to 1. 
if ix==1 
  set(findobj('tag','CLMAINPOPDATA'),'value',1) 
elseif ix==2 
  set(findobj('tag','CLMAINPOPMOD'),'value',1) 
elseif ix==4 
  set(findobj('tag','CLMAINPOPCONTR'),'value',1) 
end 
end