comparison m-toolbox/classes/@ao/minus.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % MINUS implements subtraction operator for analysis objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: MINUS implements subtraction operator for two analysis objects.
5 %
6 % CALL:
7 % a = a1-a2
8 % a = minus(a1,a2);
9 % a = minus(a1,a2,a3) == minus(minus(a1,a2),a3)
10 %
11 % More than two inputs are handled with nested calls.
12 %
13 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'minus')">Parameters Description</a>
14 %
15 % VERSION: $Id: minus.m,v 1.39 2011/04/08 08:56:17 hewitson Exp $
16 %
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18
19 function varargout = minus(varargin)
20
21 % Settings
22 op = 'minus';
23 opname = 'subtract';
24 opsym = '-';
25
26 if nargout == 0
27 error('### A %s operator can not be used as a modifier.', opname);
28 end
29
30 callerIsMethod = utils.helper.callerIsMethod;
31
32 if callerIsMethod
33 aosNames = {};
34 else
35 % collect input variable names
36 for ii = 1:nargin,aosNames{ii} = inputname(ii);end
37 end
38
39 % apply operator
40 res = ao.elementOp(callerIsMethod, @getInfo, @getDefaultPlist, op, opname, opsym, aosNames, varargin(:));
41
42 % Set output
43 varargout = utils.helper.setoutputs(nargout, res);
44
45
46 end
47
48 %--------------------------------------------------------------------------
49 % Get Info Object
50 %--------------------------------------------------------------------------
51 function ii = getInfo(varargin)
52
53 if nargin == 1 && strcmpi(varargin{1}, 'None')
54 sets = {};
55 pls = [];
56 else
57 sets = {'Default'};
58 pls = getDefaultPlist;
59 end
60 % Build info object
61 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.aop, '$Id: minus.m,v 1.39 2011/04/08 08:56:17 hewitson Exp $', sets, pls);
62 ii.setArgsmin(2);
63 end
64
65 %--------------------------------------------------------------------------
66 % Get Default Plist
67 %--------------------------------------------------------------------------
68 function plout = getDefaultPlist()
69 persistent pl;
70 if ~exist('pl', 'var') || isempty(pl)
71 pl = buildplist();
72 end
73 plout = pl;
74 end
75
76 function pl = buildplist()
77 pl = plist.EMPTY_PLIST;
78 end