Home > classes > @ao > minus.m

minus

PURPOSE ^

MINUS overloads - operator for analysis objects.

SYNOPSIS ^

function b = minus(varargin)

DESCRIPTION ^

 MINUS overloads - operator for analysis objects.

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

 DESCRIPTION: MINUS overloads - operator for analysis objects.

 CALL:        a = a1-a2

 VERSION:     $Id: minus.m,v 1.12 2008/02/13 18:35:22 hewitson Exp $

 The following call returns a parameter list object that contains the
 default parameter values:

 >> pl = minus(ao, 'Params')

 The following call returns a string that contains the routine CVS version:

 >> version = minus(ao,'Version')

 The following call returns a string that contains the routine category:

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

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