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

    function updateFromTradeoff(obj)
%UPDATEFROMTRADEOFF Update cached information from the tradeoff object
%
%  UPDATEFROMTRADEOFF(OBJ) updates all of the cached information from the
%  current tradeoff in the message service that this object is attached to.

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


ms = obj.hMessageService;
pTO = ms.CurrentTradeoff;
if ~isempty(pTO) ...
        && (ms.hasValidListIndex || ms.hasValidTableIndex)
    
    hTO = pTO.info;
    ms.setInputsToCurrentPoint;
    
    % Get input pointers
    [obj.pInputs, obj.pTableInputs, obj.pPassiveInputs] = getInputs(hTO);
    
    % Get input values
    if ~isempty(obj.pInputs)
        vals = pveceval(obj.pInputs, @getvalue);
        obj.Values = [vals{:}];
    else
        obj.Values = [];
    end
    if ~isempty(obj.pTableInputs)
        obj.TableValues = pveceval(obj.pTableInputs, @getvalue);
    else
        obj.TableValues = {};
    end
    if ~isempty(obj.pPassiveInputs)
        obj.PassiveValues = pveceval(obj.pPassiveInputs, @getvalue);
    else
        obj.PassiveValues = {};
    end
    
    if ~isempty(obj.pInputs)
        % Get whether each value is an independent input
        [unused, obj.pBaseInputs] = cgisindependentvars(obj.pInputs, obj.pInputs);
        obj.IsBaseInput = (obj.pBaseInputs==obj.pInputs);
    else
        obj.pBaseInputs = [];
    end
    
    % Find the base inputs in list of inputs
    obj.BaseIndex = 1:length(obj.pInputs);
    if any(~obj.IsBaseInput)
        [unused, obj.BaseIndex(~obj.IsBaseInput)] = ...
            ismember(obj.pBaseInputs(~obj.IsBaseInput), obj.pInputs);
    end
    
else
    empty_ptr = null(xregpointer, 0);
    obj.pInputs = empty_ptr;
    obj.Values = [];
    obj.pBaseInputs = empty_ptr;
    obj.IsBaseInput = false(0);
    obj.pTableInputs = empty_ptr;
    obj.TableValues = {};
    obj.pPassiveInputs = empty_ptr;
    obj.PassiveValues = {};
end