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.html,v 1.14 2008/03/31 10:27:33 hewitson Exp $ The following call returns a parameter list object that contains the default parameter values: >> pl = len(ao, 'Params') The following call returns a string that contains the routine CVS version: >> version = len(ao,'Version') The following call returns a string that contains the routine category: >> category = len(ao,'Category') HISTORY: 24-04-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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.html,v 1.14 2008/03/31 10:27:33 hewitson 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 % The following call returns a string that contains the routine CVS version: 0024 % 0025 % >> version = len(ao,'Version') 0026 % 0027 % The following call returns a string that contains the routine category: 0028 % 0029 % >> category = len(ao,'Category') 0030 % 0031 % HISTORY: 24-04-07 M Hewitson 0032 % Creation 0033 % 0034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0035 0036 VERSION = '$Id: len.html,v 1.14 2008/03/31 10:27:33 hewitson Exp $'; 0037 CATEGORY = 'Helper'; 0038 0039 %% Check if this is a call for parameters 0040 if nargin == 2 0041 if isa(varargin{1}, 'ao') && ischar(varargin{2}) 0042 in = char(varargin{2}); 0043 if strcmp(in, 'Params') 0044 data_len = getDefaultPL(); 0045 return 0046 elseif strcmp(in, 'Version') 0047 data_len = VERSION; 0048 return 0049 elseif strcmp(in, 'Category') 0050 data_len = CATEGORY; 0051 return 0052 end 0053 end 0054 end 0055 0056 %% store the input ao's in the vector: ao_set 0057 ao_set = []; 0058 for i=1:nargin 0059 a = varargin{i}; 0060 if isa(a, 'ao') 0061 ao_set = [ao_set a]; 0062 end 0063 end 0064 0065 data_len = zeros(size(ao_set)); 0066 0067 %% go through analysis objects 0068 for j=1:numel(ao_set) 0069 0070 a = ao_set(j); 0071 0072 [x,y] = get_xy_values(a.data); 0073 0074 ld = length(y); 0075 0076 data_len(j) = ld; 0077 end 0078 0079 %% Get default params 0080 function pl_default = getDefaultPL() 0081 0082 pl_default = plist(); 0083 0084 % END