Home > classes > @ao > mtimes.m

mtimes

PURPOSE ^

MTIMES overloads * operator for analysis objects.

SYNOPSIS ^

function b = mtimes(varargin)

DESCRIPTION ^

 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.14 2008/02/13 18:35:22 hewitson 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

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

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

Generated on Tue 26-Feb-2008 10:52:52 by m2html © 2003