diff m-toolbox/classes/@tsdata/evenly.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@tsdata/evenly.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,31 @@
+% EVENLY defines if the data is evenly sampled or not
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% 
+% DESCRIPTION: 
+%
+% CALL:     evenly = evenly(data)
+%
+% INPUTS:   tsdata - a tsdata object
+%
+% OUTPUTS:  evenly - signals whether the data is regularly sampled or not
+%
+% VERSION:  $Id: evenly.m,v 1.1 2010/04/30 14:56:30 nicolodi Exp $ 
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function evenly = evenly(data)
+
+  % if the x vector has a null dimension ether the tsdata is empty or
+  % the x vector has been collapsed. in those cases the data is
+  % assumed to be evenly sampled
+  if isempty(data.x)
+    evenly = true;
+    return;
+  end
+  
+  % otherwise we fall back to the fitfs method
+  [fs, t0, uneven] = tsdata.fitfs(data.x);
+  evenly = ~uneven;
+  
+end
+