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

    function pUpdateIOCache(obj)
%PUPDATEIOCACHE Update the caches of inputs and outputs
%
%  PUPDATEIOCACHE(OBJ) updates the cached list of tradeoff outputs.  The
%  xlim, header strings and blank cell indicator properties of the
%  datamodel are also updated as this will only change with the same
%  frequency as the expression pointer lists changing.

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


if ~isempty(obj.MessageService) ...
        && ~isempty(obj.MessageService.CurrentTradeoff)

    ms = obj.MessageService;
    pTO = ms.CurrentTradeoff;
    dm = obj.hDataModel;

    obj.OutputsCache = getOutputs(pTO.info);
    pInputs = ms.TradeoffServices.pInputs;

    hInputs = infoarray(pInputs);
    hOutputs = infoarray(obj.OutputsCache);
    nInputs = length(hInputs);
    nOutputs = length(hOutputs);

    % Update the input information
    xlims = zeros(nInputs,2);
    xlabs = cell(1, nInputs);
    for n = 1:nInputs
        xlims(n,:) = getrange(hInputs{n});
        xlabs{n} = getname(hInputs{n});
    end
    dm.XLimits = xlims;
    dm.ColumnItemLabels = xlabs;

    % Update the output information
    ylabs = cell(1, nOutputs);
    isblank = true(nOutputs, nInputs);
    for n = 1:nOutputs
        ylabs{n} = getname(hOutputs{n});

        % Make cells that are inports not blank
        pInports = getinports(hOutputs{n});
        isInportToModel = ismember(pInputs, pInports);
        isblank(n, isInportToModel) = false;
    end
    dm.RowItemLabels = ylabs;
    dm.IsBlank = isblank;

else
    obj.OutputsCache = null(xregpointer, 0);
    obj.hDataModel.XLimits = zeros(0,2);
    obj.hDataModel.RowItemLabels = {};
    obj.hDataModel.ColumnItemLabels = {};
    obj.hDataModel.IsBlank = false(0);
end