comparison m-toolbox/classes/@ao/var.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 % VAR computes the variance of the data in the AO.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: VAR computes the variance of the data in the AO.
5 %
6 % CALL: ao_out = var(ao_in);
7 % ao_out = var(ao_in, pl);
8 %
9 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'var')">Parameters Description</a>
10 %
11 % VERSION: $Id: var.m,v 1.40 2011/04/19 18:48:11 ingo Exp $
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
15 function varargout = var(varargin)
16
17 % Check if the method was called by another method
18 callerIsMethod = utils.helper.callerIsMethod;
19
20 % Settings
21 operatorName = 'var';
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 % Here we are forced to collect objects so that we can check that each ao
33 % is the correct type for doing diag.
34 as = utils.helper.collect_objects(varargin(:), 'ao', in_names);
35
36 % We filter out the data3D objects here since we don't know what to do
37 % with them so far.
38 aos = [];
39 for kk=1:numel(as)
40 if isa(as(kk).data, 'data3D')
41 warning('!!! Skipping ao [%s] - %s can''t operate on data3D objects at the moment.', as(kk).name, operatorName);
42 else
43 aos = [aos as(kk)];
44 end
45 end
46 if isempty(aos) % try for getInfo
47 out = ao.applymethod(0, callerIsMethod, in_names, operatorName, dxFcn, @getInfo, @getDefaultPlist, varargin{:});
48 varargout{1} = out;
49 return
50 end
51
52
53 copyObjects = nargout>0;
54 [bs, pl] = ao.applymethod(copyObjects, callerIsMethod, in_names, operatorName, dxFcn, @getInfo, @getDefaultPlist, varargin{:});
55
56 bs = fixAxisData(bs, pl);
57
58 if isa(bs, 'ao')
59 % Clear errors
60 bs.clearErrors(pl);
61 end
62
63 % set outputs
64 varargout = utils.helper.setoutputs(nargout, bs);
65 end
66
67 %--------------------------------------------------------------------------
68 % Get Info Object
69 %--------------------------------------------------------------------------
70 function ii = getInfo(varargin)
71 ii = minfo.getInfoAxis(mfilename, @getDefaultPlist, varargin);
72 end
73
74 %--------------------------------------------------------------------------
75 % Get Default Plist
76 %--------------------------------------------------------------------------
77
78 function plout = getDefaultPlist(set)
79 persistent pl;
80 persistent lastset;
81 if ~exist('pl', 'var') || isempty(pl) || ~strcmp(lastset, set)
82 pl = buildplist(set);
83 lastset = set;
84 end
85 plout = pl;
86 end
87
88 function plout = buildplist(varargin)
89 plout = plist.getDefaultAxisPlist(varargin{:});
90 end
91