Home > classes > @ao > len.m

len

PURPOSE ^

LEN overloads the length operator for Analysis objects. Length of the data samples.

SYNOPSIS ^

function data_len = len(varargin)

DESCRIPTION ^

 LEN overloads the length operator for Analysis objects. Length of the data samples.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: LEN overloads the length operator for Analysis objects.
              Number of data samples in the analysis object.
              LEN(ao) is the length of the elements of ao.data.

 CALL: l = len(ao_in);

 POSSIBLE VALUES: ao_in  = [ao2 ao3]
                  ao_in  = ao_vector
                  ao_in  = ao_matrix

 VERSION: $Id: len.m,v 1.8 2007/10/31 17:03:45 ingo Exp $

 The following call returns a parameter list object that contains the
 default parameter values:

 >> pl = len(ao, 'Params')

 HISTORY: 24-04-07 M Hewitson
             Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function data_len = len(varargin)
0002 % LEN overloads the length operator for Analysis objects. Length of the data samples.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: LEN overloads the length operator for Analysis objects.
0007 %              Number of data samples in the analysis object.
0008 %              LEN(ao) is the length of the elements of ao.data.
0009 %
0010 % CALL: l = len(ao_in);
0011 %
0012 % POSSIBLE VALUES: ao_in  = [ao2 ao3]
0013 %                  ao_in  = ao_vector
0014 %                  ao_in  = ao_matrix
0015 %
0016 % VERSION: $Id: len.m,v 1.8 2007/10/31 17:03:45 ingo Exp $
0017 %
0018 % The following call returns a parameter list object that contains the
0019 % default parameter values:
0020 %
0021 % >> pl = len(ao, 'Params')
0022 %
0023 % HISTORY: 24-04-07 M Hewitson
0024 %             Creation
0025 %
0026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0027 
0028 VERSION = '$Id: len.m,v 1.8 2007/10/31 17:03:45 ingo Exp $';
0029 
0030 %% Check if this is a call for parameters
0031 if nargin == 2
0032   if isa(varargin{1}, 'ao') && ischar(varargin{2})
0033     in = char(varargin{2});
0034     if strcmp(in, 'Params')
0035       data_len = getDefaultPL();
0036       return
0037     elseif strcmp(in, 'Version')
0038       data_len = VERSION;
0039       return
0040     end
0041   end
0042 end
0043 
0044 %% store the input ao's in the vector: ao_set
0045 ao_set = [];
0046 for i=1:nargin
0047   a = varargin{i};
0048   if isa(a, 'ao')
0049     ao_set  = [ao_set a];
0050   end
0051 end
0052 
0053 data_len = zeros(size(ao_set));
0054 
0055 %% go through analysis objects
0056 for j=1:numel(ao_set)
0057 
0058   a = ao_set(j);
0059 
0060   [x,y] = get_xy_values(a.data);
0061 
0062   ld = length(y);
0063 
0064   data_len(j) = ld;
0065 end
0066 
0067 %% Get default params
0068 function pl_default = getDefaultPL()
0069 
0070   pl_default = plist();
0071 
0072 % END

Generated on Fri 02-Nov-2007 19:39:27 by m2html © 2003