Mercurial > hg > ltpda
comparison m-toolbox/classes/@tsdata/collapseX.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % COLLAPSEX Checks whether the x vector is evenly sampled and then removes it | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: Checks whether the x vector is evenly sampled and then removes | |
5 % it after setting the t0 field. | |
6 % | |
7 % CALL: obj = collapseX(obj) | |
8 % | |
9 % INPUT: obj - tsdata object | |
10 % | |
11 % OUTPUT: obj - tsdata object | |
12 % | |
13 % VERSION: $Id: collapseX.m,v 1.9 2011/06/30 16:24:12 ingo Exp $ | |
14 % | |
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
16 | |
17 function varargout = collapseX(varargin) | |
18 | |
19 obj = varargin{1}; | |
20 | |
21 %%% decide whether we modify the pz-object, or create a new one. | |
22 obj = copy(obj, nargout); | |
23 | |
24 if ~isempty(obj.x) | |
25 [fs, t0, uneven] = tsdata.fitfs(obj.x); | |
26 if uneven | |
27 obj.fs = fs; | |
28 else | |
29 % adjust T0 | |
30 obj.toffset = obj.toffset + obj.x(1)*1e3; | |
31 % adjust Nsecs | |
32 obj.nsecs = length(obj.y)/obj.fs; | |
33 % remove X samples | |
34 obj.x = []; | |
35 end | |
36 end | |
37 | |
38 varargout{1} = obj; | |
39 end | |
40 |