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