MTIMES overloads * operator for analysis objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: MTIMES overloads * operator for analysis objects. This just does the same as times (*) for analysis objects. CALL: a = a1*scalar a = a1*a2 VERSION: $Id: mtimes.m,v 1.17 2008/03/04 17:28:53 ingo Exp $ The following call returns a parameter list object that contains the default parameter values: >> pl = mtimes(ao, 'Params') The following call returns a string that contains the routine CVS version: >> version = mtimes(ao,'Version') The following call returns a string that contains the routine category: >> category = mtimes(ao,'Category') HISTORY: 05-02-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % MTIMES overloads * operator for analysis objects. 0002 % 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % 0005 % DESCRIPTION: MTIMES overloads * operator for analysis objects. 0006 % This just does the same as times (*) for analysis objects. 0007 % 0008 % CALL: a = a1*scalar 0009 % a = a1*a2 0010 % 0011 % VERSION: $Id: mtimes.m,v 1.17 2008/03/04 17:28:53 ingo Exp $ 0012 % 0013 % The following call returns a parameter list object that contains the 0014 % default parameter values: 0015 % 0016 % >> pl = mtimes(ao, 'Params') 0017 % 0018 % The following call returns a string that contains the routine CVS version: 0019 % 0020 % >> version = mtimes(ao,'Version') 0021 % 0022 % The following call returns a string that contains the routine category: 0023 % 0024 % >> category = mtimes(ao,'Category') 0025 % 0026 % HISTORY: 05-02-07 M Hewitson 0027 % Creation 0028 % 0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0030 0031 function b = mtimes(varargin) 0032 0033 ALGONAME = mfilename; 0034 VERSION = '$Id: mtimes.m,v 1.17 2008/03/04 17:28:53 ingo Exp $'; 0035 CATEGORY = 'Arithmetic Operator'; 0036 0037 %% Check if this is a call for parameters 0038 if nargin == 2 0039 if isa(varargin{1}, 'ao') && ischar(varargin{2}) 0040 in = char(varargin{2}); 0041 if strcmp(in, 'Params') 0042 b = getDefaultPL(); 0043 return 0044 elseif strcmp(in, 'Version') 0045 b = VERSION; 0046 return 0047 elseif strcmp(in, 'Category') 0048 b = CATEGORY; 0049 return 0050 end 0051 end 0052 end 0053 0054 % Collect input ao's, plist's and ao variable names 0055 in_names = {}; 0056 for ii = 1:nargin 0057 in_names{end+1} = inputname(ii); 0058 end 0059 0060 [as, pl, invars] = collect_inputs(varargin, in_names); 0061 0062 op = '*'; 0063 0064 [a1,a2,do] = aooperate(varargin, op); 0065 0066 %--------- create output AO 0067 0068 % make a new history object 0069 h = history(ALGONAME, VERSION, plist(), [a1.hist a2.hist]); 0070 h = set(h, 'invars', invars); 0071 0072 % get names for output 0073 if isempty(char(invars{1})) 0074 n1 = a1.name; 0075 else 0076 n1 = char(invars{1}); 0077 end 0078 if isempty(char(invars{2})) 0079 n2 = a2.name; 0080 else 0081 n2 = char(invars{2}); 0082 end 0083 0084 % make output analysis object 0085 b = ao(do, h); 0086 b = setnh(b, 'name', sprintf('%s %s %s', n1, op, n2)); 0087 0088 0089 %% Get default params 0090 function pl_default = getDefaultPL() 0091 0092 pl_default = plist(); 0093 0094 % END