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

    function con = setActiveIndices(con, newAi)
%SETACTIVEINDICES Set the indices of the active factors for a 1d table constraint
%
%  CON = SETACTIVEINDICES(CON, AI)
%
%  This method keeps break points and table information for active indices
%  that are not changing. Where the active indices change the break points
%  and the table values are reset to senible defaults based on the
%  appropriate active factor and the current settings for the constraint.
%
%  See also CONBASE, 
%           CONBASE/GETACTIVEINDICES,
%           CONBASE/GETACTIVEFACTORS,
%           CONBASE/NACTIVEFACTORSALLOWED,
%           CONBASE/SETMATCHEDFACTORS.

%  Copyright 2004-2005 The MathWorks, Inc.

if numel( newAi ) ~= 2,
    error(message('mbc:contable1:InvalidArgument1'));
end

newAi = newAi(:).';
oldAi = getActiveIndices( con ); 
cif = getInputFactors( con );

if newAi(1) ~= oldAi(1),
    con.breakcols = linspace( cif(1).Min, cif(1).Max, length( con.breakcols ) );
end
if newAi(2) ~= oldAi(2),
    if con.le,
        con.table(:) = cif(2).Max;
    else
        con.table(:) = cif(2).Min;
    end
end

% Set the active indices in the parent object
con.conbase = setActiveIndices( con.conbase, newAi );

%------------------------------------------------------------------------------|
% EOF
%------------------------------------------------------------------------------|