Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/uminus.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 % UMINUS overloads the uminus operator for analysis objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: UMINUS overloads the uminus operator for analysis objects. | |
5 % uminus(ao) negates all the elements of ao.data. | |
6 % | |
7 % CALL: ao_out = uminus(ao_in); | |
8 % ao_out = uminus(ao_in, pl); | |
9 % ao_out = uminus(ao1, pl1, ao_vector, ao_matrix, pl2); | |
10 % | |
11 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'uminus')">Parameters Description</a> | |
12 % | |
13 % VERSION: $Id: uminus.m,v 1.25 2011/04/19 18:48:11 ingo Exp $ | |
14 % | |
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
16 | |
17 function varargout = uminus(varargin) | |
18 | |
19 % Check if the method was called by another method | |
20 callerIsMethod = utils.helper.callerIsMethod; | |
21 | |
22 % Settings | |
23 operatorName = 'uminus'; | |
24 dxFcn = @(x,dx)abs(-1).*dx; | |
25 | |
26 if callerIsMethod | |
27 in_names = {}; | |
28 else | |
29 % Collect input variable names | |
30 in_names = cell(size(varargin)); | |
31 for ii = 1:nargin,in_names{ii} = inputname(ii);end | |
32 end | |
33 | |
34 copyObjects = nargout>0; | |
35 [bs, pl] = ao.applymethod(copyObjects, callerIsMethod, in_names, operatorName, dxFcn, @getInfo, @getDefaultPlist, varargin{:}); | |
36 | |
37 % set outputs | |
38 varargout = utils.helper.setoutputs(nargout, bs); | |
39 | |
40 end | |
41 | |
42 %-------------------------------------------------------------------------- | |
43 % Get Info Object | |
44 %-------------------------------------------------------------------------- | |
45 function ii = getInfo(varargin) | |
46 ii = minfo.getInfoAxis(mfilename, @getDefaultPlist, varargin); | |
47 end | |
48 | |
49 %-------------------------------------------------------------------------- | |
50 % Get Default Plist | |
51 %-------------------------------------------------------------------------- | |
52 | |
53 function plout = getDefaultPlist(set) | |
54 persistent pl; | |
55 persistent lastset; | |
56 if ~exist('pl', 'var') || isempty(pl) || ~strcmp(lastset, set) | |
57 pl = buildplist(set); | |
58 lastset = set; | |
59 end | |
60 plout = pl; | |
61 end | |
62 | |
63 function plout = buildplist(varargin) | |
64 plout = plist.getDefaultAxisPlist(varargin{:}); | |
65 end | |
66 |