diff m-toolbox/classes/@matrix/fixfs.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/@matrix/fixfs.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,108 @@
+% FIXFS adjusts the sample frequency of each time-series AO in the matrix.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: FIXFS adjusts the sample frequency of each time-series AO in the matrix.
+%
+% CALL:        out = fixfs(in,pl);
+%
+% Note: this is just a wrapper of ao/fixfs. Each AO in the matrix is passed
+% to fixfs with the input plist. 
+% 
+% INPUTS:      in      -  input matrix objects 
+%              pl      -  parameter list
+%
+% OUTPUTS:     out     -  output matrix objects 
+%
+% <a href="matlab:utils.helper.displayMethodInfo('matrix', 'fixfs')">Parameters Description</a>
+%
+% VERSION:     $Id: fixfs.m,v 1.1 2011/08/23 13:51:17 hewitson Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function varargout = fixfs(varargin)
+  
+  % Check if this is a call for parameters
+  if utils.helper.isinfocall(varargin{:})
+    varargout{1} = getInfo(varargin{3});
+    return
+  end
+  
+  if nargout == 0
+    error('### Matrix split method can not be used as a modifier.');
+  end
+    
+  % Collect input variable names
+  in_names = cell(size(varargin));
+  for ii = 1:nargin
+    in_names{ii} = inputname(ii);
+  end
+  
+  % Collect all matrix objects and plists
+  [ms, matrix_invars, rest] = utils.helper.collect_objects(varargin(:), 'matrix', in_names);
+  [pl, pl_invars, rest]     = utils.helper.collect_objects(rest(:), 'plist', in_names);
+  
+  % call the matrix wrapper
+  varargout{1} = wrapper(ms, pl, getInfo('None'), in_names, 'fixfs');  
+  
+end
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                               Local Functions                               %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% FUNCTION:    getInfo
+%
+% DESCRIPTION: Get Info Object
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function ii = getInfo(varargin)
+  
+  if nargin == 1 && strcmpi(varargin{1}, 'None')
+    sets = {};
+    pls  = [];
+  else
+    ii = ao.getInfo('fixfs');
+    sets = ii.sets;
+    pls = [];
+    for kk=1:numel(sets)
+      pls = [pls getDefaultPlist(sets{kk})];
+    end
+  end
+  % Build info object
+  ii = minfo(mfilename, 'matrix', 'ltpda', utils.const.categories.aop, '$Id: fixfs.m,v 1.1 2011/08/23 13:51:17 hewitson Exp $', sets, pls);
+  ii.setArgsmin(2);
+  ii.setModifier(false);
+end
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% FUNCTION:    getDefaultPlist
+%
+% DESCRIPTION: Get Default Plist
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%--------------------------------------------------------------------------
+% Get Default Plist
+%--------------------------------------------------------------------------
+function plout = getDefaultPlist(set)
+  persistent pl;
+  persistent lastset;
+  if exist('pl', 'var')==0 || isempty(pl) || ~strcmp(lastset, set)
+    pl = buildplist(set);
+    lastset = set;
+  end
+  plout = pl;
+end
+
+function pl = buildplist(set)
+  
+  ii = ao.getInfo('fixfs', set);
+  pl = ii.plists(1);
+
+end