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

    function setValue(obj, pInput, Value, EventSuppressionFlag)
%SETVALUE Manually alter a candidate input value
%
%  SETVALUE(OBJ, PINPUT, VALUE) alters the candidate value for PINPUT to be
%  VALUE.  PINPUT may be either a pointer to an input variable or an index
%  into the cached list of inputs in this object.

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


if nargin<4
    % Flag that suppresses the final event sending action - this is private
    % to the object.
    EventSuppressionFlag = false;
end
if ~isnumeric(pInput)
    idx = find(pInput == obj.pInputs);
else
    idx = pInput;
    pInput = obj.pInputs(idx);
end
obj.Values(idx) = Value;

if any(~obj.isBaseInput)
    % Check whether there are inputs that will change along with this one
    islinked = ~cgisindependentvars(obj.pInputs, pInput);
    
    % Remove the false positive from itself
    islinked(idx) = false;
    if any(islinked)
        % Need to set the value and get the resulting changes in linked
        % objects
        pInput.info = pInput.setvalue(Value);  
        vals = pveceval(obj.pInputs(islinked), @getvalue);
        obj.Values(islinked) = [vals{:}];
    end
end

if ~EventSuppressionFlag
    obj.hMessageService.notifyCandidateValueChange;
end