www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@sweepsetfilter/addResampling.m

    function obj = addResampling(obj, varNamesToAdd, resampleExp)
%ADDRESAMPLING Add a resampling operation to a sweepsetfilter
%
%  SSF = ADDRESAMPLING(SSF, VARNAMES, RESAMPLEEXP) adds a resampling
%  expression to the sweepsetfilter. VARNAMES is a variable or variables
%  that each of the resample processes apply to.  VARNAMES must either be a
%  string with a single variable name or a cell array of strings of
%  multiple variable names. If multiple variables are give, then these will
%  be processed simultaneously by the resample function, in the sense that
%  any 'x' in the resample expression, RESAMPLEEXP, will be replace a
%  matrix with one column for each variable.
%
%  Examples:
%    ssf = addResampling(ssf, 'X', 'f(x)')
%    ssf = addResampling(ssf, {'X','Y'}, 'f(x)')
%
%  See also SWEEPSETFILTER, SWEEPSETFILTER/MODIFYRESAMPLING,
%  SWEEPSETFILTER/REMOVERESAMPLING. 

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


% Get the resampling structure from the object
resampling = obj.resampling;

% If the variables are given in a cell array we want to ensure these are in a row. 
if iscell( varNamesToAdd )
    varNamesToAdd = varNamesToAdd(:)';
end

% Store the string given by the user
resampling.resampleExp{end+1} = resampleExp;

% Add the new variables to the end of the list
resampling.varNames{end+1} = varNamesToAdd;

% Put the resampling structure back into the object
obj.resampling = resampling;

% Update the object with the new resampling
obj = updateResampling( obj, [] );