UMINUS overloads the uminus operator for Analysis objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: UMINUS overloads the uminus operator for Analysis objects. uminus(ao) negates all the elements of ao.data. CALL: ao_out = uminus(ao_in); ao_out = uminus(ao_in, pl); ao_out = uminus(ao1, pl1, ao_vector, ao_matrix, pl2); M-FILE INFO: Get information about this methods by calling >> ao.getInfo('times') Get information about a specified set-plist by calling: >> ao.getInfo('times', 'None') VERSION: $Id: uminus.m,v 1.7 2008/09/05 11:15:19 ingo Exp $ HISTORY: 06-05-2008 Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % UMINUS overloads the uminus operator for Analysis objects. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: UMINUS overloads the uminus operator for Analysis objects. 0005 % uminus(ao) negates all the elements of ao.data. 0006 % 0007 % CALL: ao_out = uminus(ao_in); 0008 % ao_out = uminus(ao_in, pl); 0009 % ao_out = uminus(ao1, pl1, ao_vector, ao_matrix, pl2); 0010 % 0011 % M-FILE INFO: Get information about this methods by calling 0012 % >> ao.getInfo('times') 0013 % 0014 % Get information about a specified set-plist by calling: 0015 % >> ao.getInfo('times', 'None') 0016 % 0017 % VERSION: $Id: uminus.m,v 1.7 2008/09/05 11:15:19 ingo Exp $ 0018 % 0019 % HISTORY: 06-05-2008 Hewitson 0020 % Creation 0021 % 0022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0023 0024 function varargout = uminus (varargin) 0025 0026 % Check if this is a call for parameters 0027 if utils.helper.isinfocall(varargin{:}) 0028 varargout{1} = getInfo(varargin{3}); 0029 return 0030 end 0031 0032 import utils.const.* 0033 utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename); 0034 0035 % Collect input variable names 0036 in_names = cell(size(varargin)); 0037 for ii = 1:nargin,in_names{ii} = inputname(ii);end 0038 0039 % Collect all AOs 0040 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); 0041 pl = utils.helper.collect_objects(varargin(:), 'plist', in_names); 0042 0043 % Decide on a deep copy or a modify 0044 bs = copy(as, nargout); 0045 0046 % Combine plists 0047 pl = combine(pl, getDefaultPlist); 0048 0049 % Apply method to all AOs 0050 applymethod(bs, ao_invars, 'uminus', pl, getDefaultPlist, getInfo); 0051 0052 % Set output 0053 if nargout > 0 0054 varargout{1} = bs; 0055 end 0056 end 0057 0058 %-------------------------------------------------------------------------- 0059 % Get Info Object 0060 %-------------------------------------------------------------------------- 0061 function ii = getInfo(varargin) 0062 if nargin == 1 && strcmpi(varargin{1}, 'None') 0063 sets = {}; 0064 pl = []; 0065 else 0066 sets = {'Default'}; 0067 pl = getDefaultPlist; 0068 end 0069 % Build info object 0070 ii = minfo(mfilename, 'ao', '', utils.const.categories.op, '$Id: uminus.m,v 1.7 2008/09/05 11:15:19 ingo Exp $', sets, pl); 0071 end 0072 0073 %-------------------------------------------------------------------------- 0074 % Get Default Plist 0075 %-------------------------------------------------------------------------- 0076 function pl_default = getDefaultPlist() 0077 pl_default = plist('axis', 'y'); 0078 end 0079 % END