FOO description for function 'foo' in one line. Necessary for lookfor functionality. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: FOO detailed description for the function 'foo' CALL: foo(a) [a, b] = foo(a,pl) INPUTS: a - analysis object(s) pl - parameter list(s) OUTPUTS: a - ??? b - ??? M-FILE INFO: Get information about this methods by calling >> ao.getInfo('foo') Get information about a specified set-plist by calling: >> ao.getInfo('foo', 'set') VERSION: $Id: ao_fcn_template.m,v 1.14 2008/08/07 15:37:23 ingo Exp $ HISTORY: dd-mm-yyyy M Hewitson Creation SEE ALSO: ao/cos, ao/tan, ao/asin, acos, atan %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % FOO description for function 'foo' in one line. Necessary for lookfor functionality. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: FOO detailed description for the function 'foo' 0005 % 0006 % CALL: foo(a) 0007 % [a, b] = foo(a,pl) 0008 % 0009 % INPUTS: a - analysis object(s) 0010 % pl - parameter list(s) 0011 % 0012 % OUTPUTS: a - ??? 0013 % b - ??? 0014 % 0015 % M-FILE INFO: Get information about this methods by calling 0016 % >> ao.getInfo('foo') 0017 % 0018 % Get information about a specified set-plist by calling: 0019 % >> ao.getInfo('foo', 'set') 0020 % 0021 % VERSION: $Id: ao_fcn_template.m,v 1.14 2008/08/07 15:37:23 ingo Exp $ 0022 % 0023 % HISTORY: dd-mm-yyyy M Hewitson 0024 % Creation 0025 % 0026 % SEE ALSO: ao/cos, ao/tan, ao/asin, acos, atan 0027 % 0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0029 0030 function varargout = foo(varargin) 0031 0032 %%% Check if this is a call for parameters 0033 if utils.helper.isinfocall(varargin{:}) 0034 varargout{1} = getInfo(varargin{3}); 0035 return 0036 end 0037 0038 %%% Collect input variable names 0039 in_names = cell(size(varargin)); 0040 for ii = 1:nargin,in_names{ii} = inputname(ii);end 0041 0042 %%% Collect all AOs 0043 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); 0044 pli = utils.helper.collect_objects(varargin(:), 'plist', in_names); 0045 0046 %%% Decide on a deep copy or a modify 0047 %%% REMARK: If you create a new AO (call the constructor) then 0048 %%% it is not necessay to copy the input-AOs !!!!!!!!!!!!!!!!!!!!!!!!! 0049 bs = copy(as, nargout); 0050 0051 %%% Combine plists 0052 pl = combine(pli, getDefaultPlist); 0053 0054 %%% go through analysis objects 0055 for kk = 1:numel(bs) 0056 0057 %%%%%%%%%% some calculations %%%%%%%%%% 0058 bs(kk).data.setY(some_new_data); 0059 bs(kk).data.setFs(new_fs); 0060 bs(kk).data.setXunits(new_xunits); 0061 0062 %%% Set Name 0063 bs(kk).setName('new name', 'internal'); 0064 %%% A better way to set the name 0065 bs(kk).name = 'new name'; 0066 0067 %%% Add History 0068 bs(kk).addHistory(getInfo('Special set or all sets? You decide.'), pli, ao_invars(kk), bs(kk).hist); 0069 0070 end 0071 0072 %%% Prepare the output 0073 varargout{1} = bs; 0074 0075 end 0076 0077 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0078 % Local Functions % 0079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0080 0081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0082 % 0083 % FUNCTION: getInfo 0084 % 0085 % DESCRIPTION: Get Info Object 0086 % 0087 % HISTORY: 11-07-07 M Hewitson 0088 % Creation. 0089 % 0090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0091 0092 function ii = getInfo(varargin) 0093 if nargin == 1 && strcmpi(varargin{1}, 'None') 0094 sets = {}; 0095 pls = []; 0096 elseif nargin == 1 && ~isempty(varargin{1}) && ischar(varargin{1}) 0097 sets{1} = varargin{1}; 0098 pls = getDefaultPlist(sets{1}); 0099 else 0100 sets = {'set1', 'set2', 'set3'}; 0101 pls = []; 0102 for kk=1:numel(sets) 0103 pls = [pls getDefaultPlist(sets{kk})]; 0104 end 0105 end 0106 % Build info object 0107 ii = minfo(mfilename, 'CLASS', '', 'CATEGORY', '$Id: ao_fcn_template.m,v 1.14 2008/08/07 15:37:23 ingo Exp $', sets, pls); 0108 end 0109 0110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0111 % 0112 % FUNCTION: getDefaultPlist 0113 % 0114 % DESCRIPTION: Get Default Plist 0115 % 0116 % HISTORY: 11-07-07 M Hewitson 0117 % Creation. 0118 % 0119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0120 0121 function plo = getDefaultPlist(set) 0122 switch set 0123 case 'set1' 0124 plo = plist(); 0125 case 'set2' 0126 plo = plist('a', 1, 'b', 2); 0127 case 'set3' 0128 plo = plist('key', 'val'); 0129 otherwise 0130 error('### Unknown default plist for the set [%s]', set) 0131 end 0132 end 0133