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

    function setValueAtTurnOf(obj, pInput, pExpr)
%SETVALUEATTURNOF Set an input's value to match the nearest turning point of an expression
%
%  SETVALUEATTURNOF(OBJ, PINPUT, PEXPR) finds the nearest turning point of
%  the input PINPUT of the expression PEXPR and saves this as the candidate
%  value for PINPUT.  Other tradeoff inputs are held at their candidate
%  values.

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


if isnumeric(pInput)
    idx = pInput;
    pInput = obj.pInputs(idx);
end

% Snap all inputs to their current point values
obj.setPointValues;

[Value, unused, OK] = findturning(pExpr.info, pInput);

% Only save the value if a turning point is found
if OK
    obj.setValue(pInput, Value);
end