comparison m-toolbox/classes/@ao/ge.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 % GE overloads >= operator for analysis objects. Compare the y-axis values.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: GE overloads >= operator for analysis objects.
5 % Compare the y-axis values.
6 %
7 % CALL: a = b>=c;
8 %
9 % INPUTS: b - Analysis object
10 % c - Analysis object Or a number
11 %
12 % OUTPUTS: a - vector of logical values from the comparison.
13 %
14 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'ge')">Parameters Description</a>
15 %
16 % VERSION: $Id: ge.m,v 1.26 2011/04/08 08:56:17 hewitson Exp $
17 %
18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
19
20 function varargout = ge(varargin)
21
22 % Check if this is a call for parameters
23 if utils.helper.isinfocall(varargin{:})
24 varargout{1} = getInfo(varargin{3});
25 return
26 end
27
28 % Collect input variable names
29 in_names = cell(size(varargin));
30 for ii = 1:nargin,in_names{ii} = inputname(ii);end
31
32 [pl, plvars, rest] = utils.helper.collect_objects(varargin(:), 'plist', in_names);
33
34 if ~(numel(rest) == 2 && ...
35 ((isa(rest{1}, 'ao') && isa(rest{2}, 'ao')) || ...
36 (isa(rest{1}, 'ao') && isnumeric(rest{2}))))
37 error('### comparisons only between analysis objects and/or numbers.')
38 end
39
40 x = rest{1}.data.getY;
41
42 if isa(rest{2}, 'ao')
43 y = rest{2}.data.getY;
44 else
45 y = rest{2}*ones(size(x));
46 end
47
48 a = x >= y;
49
50 % Set output
51 varargout{1} = a;
52 end
53 %--------------------------------------------------------------------------
54 % Get Info Object
55 %--------------------------------------------------------------------------
56 function ii = getInfo(varargin)
57 if nargin == 1 && strcmpi(varargin{1}, 'None')
58 sets = {};
59 pl = [];
60 else
61 sets = {'Default'};
62 pl = getDefaultPlist;
63 end
64 % Build info object
65 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.relop, '$Id: ge.m,v 1.26 2011/04/08 08:56:17 hewitson Exp $', sets, pl);
66 ii.setArgsmin(2);
67 end
68 %--------------------------------------------------------------------------
69 % Get Default Plist
70 %--------------------------------------------------------------------------
71
72 function plout = getDefaultPlist()
73 persistent pl;
74 if exist('pl', 'var')==0 || isempty(pl)
75 pl = buildplist();
76 end
77 plout = pl;
78 end
79
80 function pl = buildplist()
81 pl = plist.EMPTY_PLIST;
82 end
83