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.6 2007/07/18 13:58:44 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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function l = 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.6 2007/07/18 13:58:44 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 %% Check if this is a call for parameters 0029 if nargin == 2 0030 if isa(varargin{1}, 'ao') && ischar(varargin{2}) 0031 in = char(varargin{2}); 0032 if strcmp(in, 'Params') 0033 l = getDefaultPL(); 0034 return 0035 end 0036 end 0037 end 0038 0039 l = []; 0040 0041 %% store the input ao's in the vector: ao_set 0042 ao_set = []; 0043 for i=1:nargin 0044 a = varargin{i}; 0045 if isa(a, 'ao') 0046 [m,n] = size(a); 0047 0048 for i = 1:m 0049 for j = 1:n 0050 ao_set = [ao_set a(i,j)]; 0051 end 0052 end 0053 0054 end 0055 end 0056 0057 %% go through analysis objects 0058 for j=1:length(ao_set) 0059 0060 a = ao_set(j); 0061 0062 [x,y] = get_xy_axis(a.data); 0063 0064 ld = length(y); 0065 0066 l = [l ld]; 0067 end 0068 0069 %% Get default params 0070 function pl_default = getDefaultPL() 0071 0072 disp('* creating default plist...'); 0073 pl_default = plist(); 0074 disp('* done.'); 0075 0076 % END