www.gusucode.com > sloptim工具箱matlab源码程序 > sloptim/sloptguis/@srocsdgui/@tunedparameterpnl/load.m

    function load(this,LoadStruct) 
% LOAD  method to load GUI settings stored as a structure
%
 
% Author(s): A. Stothert 01-Nov-2005
% Copyright 2005-2011 The MathWorks, Inc.

if isequal(LoadStruct.Version,1.0) || isequal(LoadStruct.Version,1.1)
   %Restore parameter settings
   if isequal(LoadStruct.Version,1.0)
      %Need to convert idx data
      this.idxData = localConvertIDXDataOneToOneOne(LoadStruct.idxData);
   else
      this.idxData = LoadStruct.idxData;
   end
   this.Data.load(LoadStruct);
   %Force the table to update
   this.updateTable;  
else
   warnstr = getString(message('Sloptim:srosisotool:warnVersionNumber'));
   warn('srosisotoolgui:LoadWarn',warnstr);
end

%% helper function to convert indexing data from v1.0 to v1.1
function newIdx = localConvertIDXDataOneToOneOne(oldIdx)

% MultiCompFormat : compensators with multiple formats
% nK              : compensators with zpk gains
% nP              : number of parameters for each compensator
% nPZ             : number of PZgroups for each compensator
% idxP            : compensators shown as parameters

newIdx.MultiCompFormat = oldIdx.MultiCompFormat;
newIdx.idxP            = oldIdx.idxP;
newIdx.nP              = oldIdx.nP;
newIdx.nK              = oldIdx.nPZ > 0;              %Always have one gain for any PZ compensator
newIdx.nPZ             = oldIdx.nPZ - newIdx.nK;      %Remove 1 for zpk gain parameter