www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptimoutput/loadobj.m

    function obj = loadobj(obj)
%LOADOBJ Load-time object actions
%
%  OBJ = LOADOBJ(OBJ)

%  Copyright 2006 The MathWorks, Inc.


if obj.version<2
    % Clean up incorrect values and types in the tableList field
    if ~isa(obj.tableList, 'xregpointer')
        obj.tableList = mbcpointer(1,0);
    else
        obj.tableList = obj.tableList(~isnull(obj.tableList));
    end
    
    obj.version = 2;
end

if obj.version<3
    % Add an array of bit flags - one flag per solution and run.
    if ~isempty(obj.outputData)
        szout = size(obj.outputData{1});
        if length(szout)<3
            szout = [szout 1];
        end
    else
        szout = [0 0 0];
    end
    obj.solutionFlags = zeros(szout(1), szout(3), 'uint8');
    
    % Initialise the flags that are used for acceptability from the exit
    % flags
    EF = obj.runFlags;
    if size(EF,2)==1 && szout(3)>1
        EF = repmat(EF, 1, szout(3));
    end
    F = pGetSolutionFlagNames;
    obj = pSetSolutionFlags(obj, ':', ':', F.ACCEPTABLE, EF>0);
    
    % Add a display constraint tolerance for highlighting broken
    % constraints.  This is initialised to the problem's TolCon if
    % available.
    obj.displayConTol = pFindDefaultConTol(obj.optimRunner);
    
    % Remove the tableList property and replace with the tableFiller
    % property
    obj = rmfield(obj, 'tableList');   
    obj.tableFiller = [];
    
    obj.version = 3;
end

if isstruct(obj)
    % Convert structure to a class
    obj = cgoptimoutput(obj);
end