www.pudn.com > Closid30.rar > CLWIMXMC.M, change:1999-02-01,size:6389b


function clwimxmc(string1,string2) 
% clwimxmc(string1,string2) 
% 
% Constructing window for model/controller import/export. 
% string1: 'M': model; 'C': controller. 
% string2: 'imp' : import; 'exp': export. 
 
% Functions called: clsetcol,clmcimp,clmodexp,clconexp, 
%                   clerrdia,clobjget 
 
% 27-04-1996 
% (c) Paul Van den Hof 
% Mechanical Engineering Systems and Control Group 
% Delft University of Technology 
% Last update: 19-05-1998 
%              01-02-1999 reordering edit-fields in import windows 
 
global CLIDscrz 
 
if strcmp(string1,'M') 
   option1 = 1; 
elseif strcmp(string1,'C') 
   option1 = 2; 
else 
   error('Input argument string1 to clwimxmc is invalid.') 
end 
 
if strcmp(string2,'imp') 
   option2 = 1; 
elseif strcmp(string2,'exp') 
   option2 = 2; 
else 
   error('Input argument string2 to clwimxmc is invalid.') 
end 
 
% Colors 
[frmcol,txtcol,edicol,pshcol,radcol,axscol,c7,c8,c9,c10,... 
modcol,edtcol,pubcol,putcol,chbcol,chtcol,txbcol,pstcol]=clsetcol; 
 
% Determine size and location of window: 
z=CLIDscrz; 
if option1==2 
 posfgimp=[z(3)-370 z(4)-240 330 140]; 
elseif option1==1 
 posfgimp=[40 70 300 140]; 
end 
 
% Open window and set case-independent features: 
clfgctl=figure('Menubar','none','Color',frmcol,... 
   'pos',posfgimp','Numbertitle','off','Resize','off'); 
 
% Construct frame for Model/Controller import/export window: 
frctlx=0.01;frctly=0.01; 
frctlpos=[frctlx frctly .98 .98;                % Frame 
          frctlx+0.04 frctly+0.75 .88 .16];     % "Model"/"Controller"    
typctlpos=[frctlx+0.01 frctly+0.34 .20 .16;...  % "Format" 
           frctlx+0.23 frctly+0.34 .72 .16;... 
           frctlx+0.01 frctly+0.58 .20 .16;...  % "Model"/"Controller" 
           frctlx+0.23 frctly+0.58 .25 .16;... 
           frctlx+0.02 frctly+0.06 .30 .16;...  % "IMPORT"/"EXPORT" 
           frctlx+0.34 frctly+0.06 .30 .16;...  % "HELP" 
           frctlx+0.66 frctly+0.06 .30 .16;...  % "CLOSE" 
           frctlx+0.51 frctly+0.58 .18 .16;...  % "File" 
           frctlx+0.70 frctly+0.58 .25 .16]; 
 
frctl=zeros(11,1); 
frctl(1)=uicontrol(clfgctl,'style','frame','uni','nor',... 
   'pos',frctlpos(1,:),'Back',frmcol); 
frctl(2)=uicontrol(clfgctl,'style','text','uni','nor',... 
   'pos',frctlpos(2,:),'Back',txbcol,'Fore',txtcol); 
frctl(5)=uicontrol(clfgctl,'style','text','uni','nor',... 
   'pos',typctlpos(3,:),'Back',txbcol,'Fore',txtcol); 
frctl(6)=uicontrol(clfgctl,'style','edit','uni','nor',... 
   'pos',typctlpos(4,:),'Back',edicol,'Fore',edtcol,... 
   'String',' ','horiz','left'); 
frctl(10)=uicontrol(clfgctl,'style','text','uni','nor',... 
   'pos',typctlpos(8,:),'Back',txbcol,'Fore',txtcol,... 
   'String','File'); 
frctl(11)=uicontrol(clfgctl,'style','edit','uni','nor',... 
   'pos',typctlpos(9,:),'Back',edicol,'Fore',edtcol,... 
   'String',' ','horiz','left'); 
frctl(3)=uicontrol(clfgctl,'style','text','uni','nor',... 
   'pos',typctlpos(1,:),'Back',txbcol,'Fore',txtcol,... 
   'String','Format'); 
frctl(4)=uicontrol(clfgctl,'style','popup','uni','nor',... 
   'Back',pubcol,'Fore',putcol,'pos',typctlpos(2,:),... 
   'String',' '); 
frctl(7)=uicontrol(clfgctl,'style','push','uni','nor',... 
   'pos',typctlpos(5,:),'Back',pshcol,'Fore',pstcol,... 
   'Value',0); 
frctl(8)=uicontrol(clfgctl,'style','push','uni','nor',... 
   'pos',typctlpos(6,:),'Back',pshcol,'Fore',pstcol,... 
   'String','HELP','Value',0); 
frctl(9)=uicontrol(clfgctl,'style','push','uni','nor',... 
   'pos',typctlpos(7,:),'Back',pshcol,'Fore',pstcol,... 
   'String','CLOSE','Value',0); 
 
% Put handles in userdata of figure 
us=zeros(length(frctl),1); 
us(:,1)=frctl; 
set(clfgctl,'Userdata',us); 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 
% Option-dependent cases: 
% Model handling: 
if option1==1 
 set(frctl(2),'String','MODEL'); 
 set(frctl(5),'String','Model'); 
 set(frctl(4),'String','[num;den]|[A B;C D]|theta|freqfunc'); 
 %Model import: 
 if option2==1 
   set(clfgctl,'Name',['Model import']); 
   set(frctl(7),'callb',... 
 ['eval(clmcimp(''start'',''M''),''clerrdia(''''ERROR IMPORTING MODEL:cannot locate variable'''',1)'')']); 
   set(frctl(8),'callb','hthelp(''clmodimp.htm'')'); 
   strclose=['close(gcf);h=findobj(''TAG'',''CLMAINPOPMOD'');'... 
     'set(h,''value'',1);clear h;']; 
 %Model export: 
 elseif option2==2 
   set(clfgctl,'Name',['Model export']); 
   set(frctl(4),'tag','CLMODEXPT'); 
   strclose=['close(gcf);h=findobj(''TAG'',''CLMAINPOPMOD'');'... 
     'set(h,''value'',1);clear h;']; 
   %export: data is directly transferred to object in main window 
   set(frctl(7),'callb','clmodexp'); 
   %Help 
   set(frctl(8),'callb','hthelp(''clmodexp.htm'')'); 
 
   % If the model to be exported is nonparametric, there is no choice 
   % of format: it has to be fixed to freqfunc (value=4). 
   [model,title,info,param]=clobjget('P'); 
   if param==0 
     set(frctl(4),'string','freqfunc'); 
     set(frctl(4),'style','text'); 
     set(frctl(4),'value',4); 
   end 
 end 
% 
% Controller handling: 
elseif option1==2 
 set(frctl(2),'String','CONTROLLER'); 
 set(frctl(4),'String','[num;den]|[A B;C D]'); 
 set(frctl(5),'String','Controller'); 
 %Controller import: 
 if option2==1 
   set(clfgctl,'Name',['Controller import']); 
   %import: data is directly transferred to object in main window 
   set(frctl(7),'callb',... 
    ['eval(clmcimp(''start'',''C''),''clerrdia(''''ERROR IMPORTING CONTROLLER: cannot locate variable'''',1)'')']); 
   set(frctl(8),'callb','hthelp(''clconimp.htm'')'); 
   strclose=['close(gcf);h=findobj(''TAG'',''CLMAINPOPCONTR'');'... 
   'set(h,''value'',1);clear h;']; 
 %Controller export: 
 elseif option2==2 
   set(clfgctl,'Name',['Controller export']); 
   set(frctl(4),'tag','CLCONTREXPT'); 
   strclose=['close(gcf);h=findobj(''TAG'',''CLMAINPOPCONTR'');'... 
     'set(h,''value'',1);clear h;']; 
   %export: data is directly transferred to object in main window 
   set(frctl(7),'callb','clconexp'); 
   %Help 
   set(frctl(8),'callb','hthelp(''clconexp.htm'')'); 
 end   
end 
 
set(frctl(9),'callb',strclose); 
 
if option2==1 
 set(frctl(7),'String','IMPORT'); 
elseif option2==2 
 set(frctl(7),'String','EXPORT'); 
end 
 
clear frmcol txtcol edicol pshcol radcol axscol c7 c8 c9 c10 modcol clfgctl  
clear frctl frctly frctlx frctlpos strclose stringctl typctlpos us h 
clear CLIDscrz z posfgimp