www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@conrange/resetFromInputs.m

    function con = resetFromInputs(con, ResetInd)
%RESETFROMINPUTS Reset constraint parameters after input changes
%
%  CON = RESETFROMINPUTS(CON) resets all of the constraint parameters that
%  depend on input factor settings to their default values.
%
%  CON = RESETFROMINPUTS(CON, IND) assumes that the input factors indicated
%  by the indices in IND have changed and resets only the parameters that
%  depended on the settings for those inputs.

%  Copyright 2005 The MathWorks, Inc. and Ford Global Technologies, Inc.


if nargin<2
    ResetInd = getActiveIndices(con);
else
    % Remove non-active indices as these cannot affect the settings
    ResetInd = intersect(ResetInd, getActiveIndices(con));
end

if ~isempty(ResetInd)
    [RangeMin, RangeMax] = getRange(con);
    
    cif = getInputFactors(con); 
    RangeMin(ResetInd) = cif(ResetInd).Min;
    RangeMax(ResetInd) = cif(ResetInd).Max;
    
    con = setRange(con, RangeMin, RangeMax);
end