www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcmodel/@data/ModifyFilter.m

    function D = ModifyFilter(D, index, expr)
%MODIFYFILTER Modify a user-defined filter in a data set.
%
%   D = MODIFYFILTER(D, FILTER_INDEX, NEW_FILTER_EXPRESSION);
%
%   See also mbcmodel.data.AddFilter, mbcmodel.data.RemoveFilter.

%   Copyright 2004-2007 The MathWorks, Inc.

error(mbcnargchk(3, 3, nargin, 'mbc:mbcmodel:data'));

% Make sure that the object is editable
D.pCheckIsBeingEdited;
try
    % Make sure the index is correct
    if index < 1
        error(message('mbc:mbcmodel:data:InvalidIndex'));
    end
    if index > numFilters(D.Object)
        error(message('mbc:mbcmodel:data:InvalidIndex1'));
    end
    % Call the underlying method
    D.Object = modifyFilter(D.Object, index, expr);
catch E
    [mnemonic, component] = mbcGetLastError(E);
    switch [component ':' mnemonic]
        case 'data:InvalidIndex'
            error('mbc:mbcmodel:data:InvalidIndex2', E.message);
        otherwise
            error(message('mbc:mbcmodel:data:UnknownError9'));
    end
end