www.pudn.com > Closid30.rar > Clmcexp.m, change:1998-07-16,size:2040b


function [model,name,filename]=clmcexp(string) 
 
% function [model,name,filename]=clmcexp(string) 
% 
% Callback function for reading name, filename and object 
% of model/controller to be exported to workspace/file. 
% string: 'M': model; 'C': controller. 
 
% Functions called: cldebl, clobjget, th2ss, ss2tf 
 
% 01-11-1996 originally named: clmodexp 
% (c) Douwe de Vries, Paul Van den Hof 
% Mechanical Engineering Systems and Control Group 
% Delft University of Technology 
% Last update: 29-05-1997 
%              16-07-1998: Adapting model export for formats num,den and ss to contain only 
%                          the plant dynamics Go. 
 
if strcmp(string,'M') 
   option = 1; 
elseif strcmp(string,'C') 
   option = 2; 
else 
   error('Input argument string to clmcexp is invalid.') 
end 
 
% Get the data 
FIGUS=get(gcf,'Userdata'); 
 
% Get model/controller 
if option==1 
  [model,title,info,param]=clobjget('P'); 
elseif option==2 
  model=clobjget('C'); 
end 
 
% Get the format 
if get(FIGUS(4,1),'value')==1        % [num;den] 
  frmt=1; 
 elseif get(FIGUS(4,1),'value')==2    % [A B;C D] 
   frmt=2; 
 elseif get(FIGUS(4,1),'value')==3    % theta 
   frmt=3; 
 elseif get(FIGUS(4,1),'value')==4    % freqfunc 
   frmt=4; 
end 
 
if option==1 & (frmt==1|frmt==2) 
% Correction 16/07/98: 
   [nummodel,denmodel]=th2tf(model,1); 
   [amodel,bmodel,cmodel,dmodel]=tf2ss(nummodel,denmodel); 
%  [amodel,bmodel,cmodel,dmodel]=th2ss(model); 
elseif option==2 
  [amodel,bmodel,cmodel,dmodel]=clsplit(model); 
end 
 
if frmt==1 
% addition 16/07/98: 
  if option==2 
    [nummodel,denmodel]=ss2tf(amodel,bmodel,cmodel,dmodel);  
  end 
%   
  model=[nummodel;denmodel]; 
elseif frmt==2 
  model=[amodel bmodel;cmodel dmodel];  
elseif frmt==4 & param==1 
  model=th2ff(model); 
elseif param==0 & frmt~=4 
  error('A nonparametric model can only be exported in freqfunc format')   
end 
 
% Determine input strings 
name=cldebl(get(FIGUS(6,1),'String')); 
% Get the filename: 
filename=cldebl(get(FIGUS(11,1),'String'));