Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/or.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 % OR (|) overloads the or (|) method for Analysis objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: OR (|) overloads the or (|) method for Analysis objects. | |
5 % | |
6 % CALL: out = a | b; | |
7 % out = or(a, b); | |
8 % out = or(a, b, c, ...); | |
9 % out = or(a, b, pl); | |
10 % | |
11 % INPUTS: a = any shape (1x1, 1xN, Nx1, NxM) | |
12 % b,c = same shape as 'a' | |
13 % pl = PLIST object. | |
14 % | |
15 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'or')">Parameters Description</a> | |
16 % | |
17 % VERSION: $Id: or.m,v 1.8 2011/04/08 08:56:11 hewitson Exp $ | |
18 % | |
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
20 | |
21 function varargout = or(varargin) | |
22 | |
23 % Settings | |
24 op = 'or'; | |
25 opname = 'logical OR'; | |
26 opsym = '|'; | |
27 | |
28 if nargout == 0 | |
29 error('### A %s operator can not be used as a modifier.', opname); | |
30 end | |
31 | |
32 callerIsMethod = utils.helper.callerIsMethod; | |
33 | |
34 if callerIsMethod | |
35 aosNames = {}; | |
36 else | |
37 % collect input variable names | |
38 for ii = 1:nargin,aosNames{ii} = inputname(ii);end | |
39 end | |
40 | |
41 % apply operator | |
42 res = ao.elementOp(callerIsMethod, @getInfo, @getDefaultPlist, op, opname, opsym, aosNames, varargin(:)); | |
43 | |
44 % Set output | |
45 varargout = utils.helper.setoutputs(nargout, res); | |
46 | |
47 end | |
48 | |
49 %-------------------------------------------------------------------------- | |
50 % Get Info Object | |
51 %-------------------------------------------------------------------------- | |
52 function ii = getInfo(varargin) | |
53 | |
54 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
55 sets = {}; | |
56 pls = []; | |
57 else | |
58 sets = {'Default'}; | |
59 pls = getDefaultPlist; | |
60 end | |
61 % Build info object | |
62 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.aop, '$Id: or.m,v 1.8 2011/04/08 08:56:11 hewitson Exp $', sets, pls); | |
63 ii.setArgsmin(2); | |
64 end | |
65 | |
66 %-------------------------------------------------------------------------- | |
67 % Get Default Plist | |
68 %-------------------------------------------------------------------------- | |
69 function plout = getDefaultPlist() | |
70 persistent pl; | |
71 if ~exist('pl', 'var') || isempty(pl) | |
72 pl = buildplist(); | |
73 end | |
74 plout = pl; | |
75 end | |
76 | |
77 function pl = buildplist() | |
78 pl = plist.EMPTY_PLIST; | |
79 end |