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

    function [obj, ss] = updateResampling(obj, ss)
%UPDATERESAMPLING Update the data resampling
%
%  [SSF, SS] = UPDATERESAMPLING(SSF, SS) reapplies the sweepsetfilter's
%  resampling operations and returns the altered sweepset.  If a sweepset
%  is not provided as input then one will be generated from the
%  sweepsetfilter.

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


f = getFlags;

% Have we got a current copy of the sweepset
if nargin < 2 || ~isa(ss, 'sweepset')
    ss = ApplyObject(obj, [f.APPLY_DATA, f.APPLY_VARS, f.APPLY_FILT, ...
        f.APPLY_TEST, f.APPLY_SFILT, f.APPLY_SVAR, f.APPLY_REOR]);
end

% Store to see if the resampling is changed in the update process
INITIAL_resampling = obj.resampling;

% Evaluate the resampling
if isempty( obj.resampling.resampleExp )
        obj.resampling.OK = false;
        obj.resampling.result = '';
        obj.resampling.resampledSweepset = [];
else
    try
        ss = sweepsample( ss, obj.resampling.resampleExp, obj.resampling.varNames );
        obj.resampling.OK = true;
        obj.resampling.result = 'Success';
        obj.resampling.resampledSweepset = ss;
    catch ME
        obj.resampling.OK = false;
        [unused, unused, obj.resampling.result] = mbcGetLastError(ME,'MessageFormat', 'singleline');
        obj.resampling.resampledSweepset = [];
    end
end

% Has the resampling actually changed
if ~isequaln(obj.resampling, INITIAL_resampling)
    queueEvent(obj, 'ssfResamplingChanged');
end

% Apply resampling
ss = ApplyObject(obj, f.APPLY_RESAMP, ss);

% Now ensure that everyone knows the sweepsetfilter has changed - if we are
% an ssf this will update the cache, else it is up to derived classes to
% ensure that they make their changes and call the pUpdateSweepsetCache
% method
[obj, ss] = pSweepsetfilterChanged(obj, ss);