diff m-toolbox/classes/@data2D/getDx.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/@data2D/getDx.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,37 @@
+% GETDX Get the property 'dx'.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: Get the property 'dx'.
+%
+% CALL:        val = obj.getDx();
+%              val = obj.getDx(idx);
+%              val = obj.getDx(1:10);
+%
+% INPUTS:      obj - must be a single data2D object.
+%              idx - index of the data samples
+%
+% VERSION:     $Id: getDx.m,v 1.4 2011/03/21 14:55:48 mauro Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function out = getDx(data,idx)
+
+  % Get dx values
+  out = data.dx;
+
+  % Decide if the user wants all data
+  if nargin == 1
+    % Make sure we output a column
+    if size(out,1) == 1
+      out = out.';
+    end
+  else
+    if size(out,1) == 1
+      % Make sure we output a column
+      out = out(idx).';
+    else
+      out = out(idx);
+    end
+  end
+end
+