www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@contable2/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.


ActiveInd = getActiveIndices(con);
cif = getActiveFactors(con);
if nargin<2
    DO_BREAK_COL = true;
    DO_BREAK_ROW = true;
    DO_TABLE = true;
else
    DO_BREAK_COL = any(ActiveInd(1)==ResetInd);
    DO_BREAK_ROW = any(ActiveInd(2)==ResetInd);
    DO_TABLE = any(ActiveInd(3)==ResetInd);
end

if DO_BREAK_COL
    con.breakcols = linspace( cif(1).Min, cif(1).Max, length(con.breakcols) );
end

if DO_BREAK_ROW
    con.breakrows = linspace( cif(2).Min, cif(2).Max, length(con.breakrows) );
end

if DO_TABLE
    if con.le
        con.table = repmat( cif(3).Max, size(con.table) );
    else
        con.table = repmat( cif(3).Min, size(con.table) );
    end
end