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

    function setValuesFromTable(obj)
%SETVALUESFROMTABLE Set the candidate values from table cell values
%
%  SETVALUESFROMTABLE(OBJ) sets the candidate input values to match the
%  current selected table cell in the table that is filled by each input.

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


pTO = obj.hMessageService.CurrentTradeoff;
if ~isempty(pTO) && obj.hMessageService.hasValidTableIndex
    % First apply current candidate points to inputs
    obj.setPointValues;
    
    % Now overlay any table values
    pChanged = pTO.setInputsFromTableAt('table', obj.hMessageService.CurrentTableIndex{:});
    
    if ~isempty(pChanged)
        % Now retrieve all values that were altered and update this object
        % with them
        vals = pveceval(pChanged, @getvalue);
        for n = 1:length(pChanged)
            obj.setValue(pChanged(n), vals{n}, true);
        end

        % Send a single change event
        obj.hMessageService.notifyCandidateValueChange;
    end
end