comparison m-toolbox/classes/@ao/round.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 % ROUND overloads the Round method for analysis objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: ROUND round to the nearest integer.
5 %
6 % CALL: ao_out = round(ao_in);
7 % ao_out = round(ao_in, pl);
8 %
9 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'round')">Parameters Description</a>
10 %
11 % VERSION: $Id: round.m,v 1.11 2011/04/19 18:48:11 ingo Exp $
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
15 function varargout = round(varargin)
16
17 % Check if the method was called by another method
18 callerIsMethod = utils.helper.callerIsMethod;
19
20 % Settings
21 operatorName = 'round';
22 dxFcn = [];
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 % Clear errors
37 clearErrors(bs, pl);
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 ii = minfo.getInfoAxis(mfilename, @getDefaultPlist, varargin);
50 end
51
52 %--------------------------------------------------------------------------
53 % Get Default Plist
54 %--------------------------------------------------------------------------
55
56 function plout = getDefaultPlist(set)
57 persistent pl;
58 persistent lastset;
59 if ~exist('pl', 'var') || isempty(pl) || ~strcmp(lastset, set)
60 pl = buildplist(set);
61 lastset = set;
62 end
63 plout = pl;
64 end
65
66 function plout = buildplist(varargin)
67 plout = plist.getDefaultAxisPlist(varargin{:});
68 end
69