diff m-toolbox/classes/@ao/toffset.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/@ao/toffset.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,91 @@
+% TOFFSET Returns the data property 'toffset' in seconds.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: Returns the data property 'toffset' in seconds.
+%
+% ATTENTION:   The value is locally stored in the data object in
+%              milliseconds.
+%
+% CALL:        val = toffset(a1,a2,a3,...)
+%              val = toffset(as)
+%              val = as.toffset()
+%
+% INPUTS:      aN   - input analysis objects
+%              as   - input analysis objects array
+%
+% OUTPUTS:     val  - matrix with 'toffset', one value for each input object
+%
+% <a href="matlab:utils.helper.displayMethodInfo('ao', 'toffset')">Parameters Description</a>
+%
+% VERSION:     $Id: toffset.m,v 1.2 2011/06/28 15:19:20 mauro Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function varargout = toffset(varargin)
+  
+  % Check if this is a call for parameters
+  if utils.helper.isinfocall(varargin{:})
+    varargout{1} = getInfo(varargin{3});
+    return
+  end
+  
+  import utils.const.*
+  
+  % Check if the method was called by another method
+  callerIsMethod = utils.helper.callerIsMethod;
+  
+  if ~callerIsMethod
+    % Collect all AOs
+    [as, ~, rest] = utils.helper.collect_objects(varargin(:), 'ao');
+  else
+    % Assume the input is a single AO or a vector of AOs
+    as = varargin{1};
+  end
+  
+  % Get property
+  out = [];
+  for jj = 1:numel(as)
+    if isa(as(jj).data, 'tsdata')
+      out = [out as(jj).data.toffset/1e3];
+    else
+      out = [];
+      utils.helper.msg(msg.IMPORTANT, 'At least one of the input objects has no tsdata object. Setting all results to [].');
+      break
+    end
+  end
+  
+  % Set output
+  varargout{1} = out;
+  
+end
+
+%--------------------------------------------------------------------------
+% Get Info Object
+%--------------------------------------------------------------------------
+function ii = getInfo(varargin)
+  if nargin == 1 && strcmpi(varargin{1}, 'None')
+    sets = {};
+    pl   = [];
+  else
+    sets = {'Default'};
+    pl   = getDefaultPlist;
+  end
+  % Build info object
+  ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.helper, '$Id: toffset.m,v 1.2 2011/06/28 15:19:20 mauro Exp $', sets, pl);
+  ii.setModifier(false);
+end
+
+%--------------------------------------------------------------------------
+% Get Default Plist
+%--------------------------------------------------------------------------
+function plout = getDefaultPlist()
+  persistent pl;
+  if ~exist('pl', 'var') || isempty(pl)
+    pl = buildplist();
+  end
+  plout = pl;
+end
+
+function pl = buildplist()
+  pl = plist.EMPTY_PLIST;
+end