www.gusucode.com > sloptim工具箱matlab源码程序 > sloptim/sloptim/@sroengine/@OptimOptions/loadobj.m

    function this = loadobj(S)
% LOADOBJ

% Author(s): Bora Eryilmaz
% Revised:
% Copyright 2007-2008 The MathWorks, Inc.

if isstruct(S)
  this = sroengine.OptimOptions;

  if isfield(S, 'Version')
    this.Version = S.Version;
    S = rmfield(S, 'Version');
  end

  if this.Version <= 1
    % Remap values from struct to new properties.
    this = utRemapOptimOptions(this, S);
  end
else
  this = S;
end

% Set to current version
this.Version = 2;