MRDIVIDE overloads / operator for analysis objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: MRDIVIDE overloads / operator for analysis objects. CALL: a = a1/scalar a = a1/a2 VERSION: $Id: mrdivide.m,v 1.16 2008/03/04 17:28:53 ingo Exp $ The following call returns a parameter list object that contains the default parameter values: >> pl = mrdivide(ao, 'Params') The following call returns a string that contains the routine CVS version: >> version = mrdivide(ao,'Version') The following call returns a string that contains the routine category: >> category = mrdivide(ao,'Category') HISTORY: 05-02-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % MRDIVIDE overloads / operator for analysis objects. 0002 % 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % 0005 % DESCRIPTION: MRDIVIDE overloads / operator for analysis objects. 0006 % 0007 % CALL: a = a1/scalar 0008 % a = a1/a2 0009 % 0010 % VERSION: $Id: mrdivide.m,v 1.16 2008/03/04 17:28:53 ingo Exp $ 0011 % 0012 % The following call returns a parameter list object that contains the 0013 % default parameter values: 0014 % 0015 % >> pl = mrdivide(ao, 'Params') 0016 % 0017 % The following call returns a string that contains the routine CVS version: 0018 % 0019 % >> version = mrdivide(ao,'Version') 0020 % 0021 % The following call returns a string that contains the routine category: 0022 % 0023 % >> category = mrdivide(ao,'Category') 0024 % 0025 % HISTORY: 05-02-07 M Hewitson 0026 % Creation 0027 % 0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0029 0030 function b = mrdivide(varargin) 0031 0032 ALGONAME = mfilename; 0033 VERSION = '$Id: mrdivide.m,v 1.16 2008/03/04 17:28:53 ingo Exp $'; 0034 CATEGORY = 'Arithmetic Operator'; 0035 0036 %% Check if this is a call for parameters 0037 if nargin == 2 0038 if isa(varargin{1}, 'ao') && ischar(varargin{2}) 0039 in = char(varargin{2}); 0040 if strcmp(in, 'Params') 0041 b = getDefaultPL(); 0042 return 0043 elseif strcmp(in, 'Version') 0044 b = VERSION; 0045 return 0046 elseif strcmp(in, 'Category') 0047 b = CATEGORY; 0048 return 0049 end 0050 end 0051 end 0052 0053 % Collect input ao's, plist's and ao variable names 0054 in_names = {}; 0055 for ii = 1:nargin 0056 in_names{end+1} = inputname(ii); 0057 end 0058 0059 [as, pl, invars] = collect_inputs(varargin, in_names); 0060 0061 op = '/'; 0062 0063 [a1,a2,do] = aooperate(varargin, op); 0064 0065 %--------- create output AO 0066 0067 % make a new history object 0068 h = history(ALGONAME, VERSION, plist(), [a1.hist a2.hist]); 0069 h = set(h, 'invars', invars); 0070 0071 % get names for output 0072 if isempty(char(invars{1})) 0073 n1 = a1.name; 0074 else 0075 n1 = char(invars{1}); 0076 end 0077 if isempty(char(invars{2})) 0078 n2 = a2.name; 0079 else 0080 n2 = char(invars{2}); 0081 end 0082 0083 % make output analysis object 0084 b = ao(do, h); 0085 b = setnh(b, 'name', sprintf('%s %s %s', n1, op, n2)); 0086 0087 0088 %% Get default params 0089 function pl_default = getDefaultPL() 0090 0091 pl_default = plist(); 0092 0093 % END