www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgoptimnode/cgoptimnode.m

    function h = cgoptimnode(varargin)
%CGOPTIMNODE Construct a cgoptimnode object
%
%  h = CGOPTIMNODE(data) constructs a cgoptimnode object.
%  h = CGOPTIMNODE(structure) converts a structure into an object.  This is
%  used during loading of old objects.
%
%  CGOPTIMNODE inherits from CGCONTAINER
%

%  Copyright 2000-2005 The MathWorks, Inc. and Ford Global Technologies, Inc.


loadstr = 0;
if nargin==0
    loadstr = 1;
end

if nargin==1 && isstruct(varargin{1})
    % version update mechanism - fixes the input structure
    h = varargin{1};

    t = h.cgcontainer;
    h = rmfield(h,'cgcontainer');
    loadstr = 1;
else
    % construct a new object
    if nargin<1
        data = [];
    else
        data = varargin{1};
    end
    h = struct( ...
        'OutputData', mbcpointer(1,0), ...
        'Version', 2);
    if ~loadstr
        t = cgcontainer(data);
        t = guid(t,'cgoptim');
        t = name(t,'Optimization');
    else
        t = cgcontainer;
    end
end

h = class(h, 'cgoptimnode', t);

if ~loadstr
    p = xregpointer(h);
    h = p.info;
end