diff m-toolbox/classes/@ao/y.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/y.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,96 @@
+% Y Get the data property 'y'.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: Get the data property 'y'.
+%
+% CALL:        val = y(a1,a2,a3,...)
+%              val = y(as)
+%              val = as.y()
+%
+% INPUTS:      aN   - input analysis objects
+%              as   - input analysis objects array
+%
+% OUTPUTS:     val  - matrix with 'y', one column for each input object
+%
+% <a href="matlab:utils.helper.displayMethodInfo('ao', 'y')">Parameters Description</a>
+%
+% VERSION:     $Id: y.m,v 1.16 2011/04/19 17:05:45 ingo Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function varargout = y(varargin)
+
+  % Check if this is a call for parameters
+  if utils.helper.isinfocall(varargin{:})
+    varargout{1} = getInfo(varargin{3});
+    return
+  end
+
+  % Check if the method was called by another method
+  callerIsMethod = utils.helper.callerIsMethod;
+
+  if ~callerIsMethod
+    % Collect all AOs
+    [as, dummy, rest] = utils.helper.collect_objects(varargin(:), 'ao');
+
+    % Collect numeric and char arguments to pass to getY
+    args = {};
+    for kk = 1:numel(rest)
+      if isnumeric(rest{kk}) || ischar(rest{kk}) || islogical(rest{kk})
+        args = [args {rest{kk}}];
+      end
+    end
+  else
+    % Assume the input is a single AO or a vector of AOs
+    as = varargin{1};
+    
+    % Collect numeric and char arguments to pass to getY
+    args = {};
+    for kk = 2:nargin
+      if isnumeric(varargin{kk}) || ischar(varargin{kk}) || islogical(varargin{kk})
+        args = [args {varargin{kk}}];
+      end
+    end
+  end
+
+  % Get property
+  out = [];
+  for jj = 1:numel(as)
+    out = [out as(jj).data.getY(args{:})];
+  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: y.m,v 1.16 2011/04/19 17:05:45 ingo 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