Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/le.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 % LE overloads <= operator for analysis objects. Compare the y-axis values. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: LE 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', 'le')">Parameters Description</a> | |
15 % | |
16 % VERSION: $Id: le.m,v 1.24 2011/04/08 08:56:12 hewitson Exp $ | |
17 % | |
18 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
19 | |
20 function varargout = le(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 %-------------------------------------------------------------------------- | |
55 % Get Info Object | |
56 %-------------------------------------------------------------------------- | |
57 function ii = getInfo(varargin) | |
58 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
59 sets = {}; | |
60 pl = []; | |
61 else | |
62 sets = {'Default'}; | |
63 pl = getDefaultPlist; | |
64 end | |
65 % Build info object | |
66 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.relop, '$Id: le.m,v 1.24 2011/04/08 08:56:12 hewitson Exp $', sets, pl); | |
67 ii.setModifier(false); | |
68 ii.setArgsmin(2); | |
69 end | |
70 | |
71 %-------------------------------------------------------------------------- | |
72 % Get Default Plist | |
73 %-------------------------------------------------------------------------- | |
74 function plout = getDefaultPlist() | |
75 persistent pl; | |
76 if exist('pl', 'var')==0 || isempty(pl) | |
77 pl = buildplist(); | |
78 end | |
79 plout = pl; | |
80 end | |
81 | |
82 function plo = buildplist() | |
83 plo = plist.EMPTY_PLIST; | |
84 end | |
85 |