INV overloads the inverse function for Analysis Objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: INV overloads the inverse function for Analysis Objects. CALL: a = inv(a1) % only with data = cdata M-FILE INFO: Get information about this methods by calling >> ao.getInfo('inv') Get information about a specified set-plist by calling: >> ao.getInfo('inv', 'None') VERSION: $Id: inv.m,v 1.22 2008/09/05 11:15:19 ingo Exp $ HISTORY: 08-05-07 A Monsky Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % INV overloads the inverse function for Analysis Objects. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: INV overloads the inverse function for Analysis Objects. 0005 % 0006 % CALL: a = inv(a1) % only with data = cdata 0007 % 0008 % M-FILE INFO: Get information about this methods by calling 0009 % >> ao.getInfo('inv') 0010 % 0011 % Get information about a specified set-plist by calling: 0012 % >> ao.getInfo('inv', 'None') 0013 % 0014 % VERSION: $Id: inv.m,v 1.22 2008/09/05 11:15:19 ingo Exp $ 0015 % 0016 % HISTORY: 08-05-07 A Monsky 0017 % Creation 0018 % 0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0020 0021 function varargout = inv(varargin) 0022 0023 % Check if this is a call for parameters 0024 if utils.helper.isinfocall(varargin{:}) 0025 varargout{1} = getInfo(varargin{3}); 0026 return 0027 end 0028 0029 import utils.const.* 0030 utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename); 0031 0032 % Collect input variable names 0033 in_names = cell(size(varargin)); 0034 for ii = 1:nargin,in_names{ii} = inputname(ii);end 0035 0036 % Collect all AOs 0037 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); 0038 0039 % Decide on a deep copy or a modify 0040 bs = copy(as, nargout); 0041 0042 %% go through analysis objects 0043 for j=1:numel(bs) 0044 if isa(bs(j).data, 'cdata') 0045 if size(bs(j).data.y,1) ~= size(bs(j).data.y,2) 0046 error('### The y data must be a square matrix.') 0047 end 0048 % Apply method to all AOs 0049 applymethod(bs(j), ao_invars(j), 'inv', plist, getDefaultPlist, getInfo); 0050 else 0051 error('### this function works for cdata type AO only') 0052 end 0053 end 0054 0055 % Set outputs 0056 if nargout > 0 0057 varargout{1} = bs; 0058 end 0059 end 0060 0061 %-------------------------------------------------------------------------- 0062 % Get Info Object 0063 %-------------------------------------------------------------------------- 0064 function ii = getInfo(varargin) 0065 if nargin == 1 && strcmpi(varargin{1}, 'None') 0066 sets = {}; 0067 pl = []; 0068 else 0069 sets = {'Default'}; 0070 pl = getDefaultPlist; 0071 end 0072 % Build info object 0073 ii = minfo(mfilename, 'ao', '', utils.const.categories.op, '$Id: inv.m,v 1.22 2008/09/05 11:15:19 ingo Exp $', sets, pl); 0074 end 0075 0076 %-------------------------------------------------------------------------- 0077 % Get Default Plist 0078 %-------------------------------------------------------------------------- 0079 function pl = getDefaultPlist() 0080 pl = plist(); 0081 end 0082 0083