view m-toolbox/classes/@tsdata/collapseX.m @ 46:ca0b8d4dcdb6
database-connection-manager
Fix
author |
Daniele Nicolodi <nicolodi@science.unitn.it> |
date |
Tue, 06 Dec 2011 19:07:27 +0100 (2011-12-06) |
parents |
f0afece42f48 |
children |
|
line source
% COLLAPSEX Checks whether the x vector is evenly sampled and then removes it
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: Checks whether the x vector is evenly sampled and then removes
% it after setting the t0 field.
%
% CALL: obj = collapseX(obj)
%
% INPUT: obj - tsdata object
%
% OUTPUT: obj - tsdata object
%
% VERSION: $Id: collapseX.m,v 1.9 2011/06/30 16:24:12 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = collapseX(varargin)
obj = varargin{1};
%%% decide whether we modify the pz-object, or create a new one.
obj = copy(obj, nargout);
if ~isempty(obj.x)
[fs, t0, uneven] = tsdata.fitfs(obj.x);
if uneven
obj.fs = fs;
else
% adjust T0
obj.toffset = obj.toffset + obj.x(1)*1e3;
% adjust Nsecs
obj.nsecs = length(obj.y)/obj.fs;
% remove X samples
obj.x = [];
end
end
varargout{1} = obj;
end