CONJ overloads the conjugate operator for Analysis objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: CONJ overloads the conjugate operator for Analysis objects. CALL: a_conj = conj VERSION: $Id: conj.html,v 1.14 2008/03/31 10:27:34 hewitson Exp $ The following call returns a parameter list object that contains the default parameter values: >> pl = conj(ao, 'Params') The following call returns a string that contains the routine CVS version: >> version = conj(ao,'Version') The following call returns a string that contains the routine category: >> category = conj(ao,'Category') HISTORY: 12-03-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = conj(varargin) 0002 % CONJ overloads the conjugate operator for Analysis objects. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: CONJ overloads the conjugate operator for Analysis objects. 0007 % 0008 % CALL: a_conj = conj 0009 % 0010 % VERSION: $Id: conj.html,v 1.14 2008/03/31 10:27:34 hewitson Exp $ 0011 % 0012 % The following call returns a parameter list object that contains the 0013 % default parameter values: 0014 % 0015 % >> pl = conj(ao, 'Params') 0016 % 0017 % The following call returns a string that contains the routine CVS version: 0018 % 0019 % >> version = conj(ao,'Version') 0020 % 0021 % The following call returns a string that contains the routine category: 0022 % 0023 % >> category = conj(ao,'Category') 0024 % 0025 % HISTORY: 12-03-07 M Hewitson 0026 % Creation 0027 % 0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0029 0030 % Check if this is a call for parameters 0031 0032 VERSION = '$Id: conj.html,v 1.14 2008/03/31 10:27:34 hewitson Exp $'; 0033 CATEGORY = 'Operator'; 0034 bs = []; 0035 0036 if nargin == 2 0037 if isa(varargin{1}, 'ao') && ischar(varargin{2}) 0038 in = char(varargin{2}); 0039 if strcmp(in, 'Params') 0040 varargout{1} = getDefaultPL(); 0041 return 0042 elseif strcmp(in, 'Version') 0043 varargout{1} = VERSION; 0044 return 0045 elseif strcmp(in, 'Category') 0046 varargout{1} = CATEGORY; 0047 return 0048 end 0049 end 0050 end 0051 0052 %% Collect input ao's, plist's and ao variable names 0053 in_names = {}; 0054 for ii = 1:nargin 0055 in_names{end+1} = inputname(ii); 0056 end 0057 0058 [as, ps, invars] = collect_inputs(varargin, in_names); 0059 0060 % check plist 0061 if isempty(ps) 0062 pl = getDefaultPL(); 0063 else 0064 pl = combine(ps, getDefaultPL); 0065 end 0066 0067 %% go through analysis objects 0068 for j=1:numel(as) 0069 a = as(j); 0070 0071 [h, conj_data] = single_operation(a.data, 'conj', pl); 0072 0073 %% Set the x, y-units to their old values (without abs()) 0074 conj_data = set(conj_data, 'xunits', a.data.xunits); 0075 conj_data = set(conj_data, 'yunits', a.data.yunits); 0076 conj_data = set(conj_data, 'name', sprintf ('conj(%s)',a.data.name)); 0077 0078 %% Add the history from the ao object to the history 0079 h = set(h, 'inhists', [a.hist]); 0080 0081 %% Set the var_name to the history 0082 h = set(h, 'invars', cellstr(invars{j})); 0083 0084 %% create a new analysis objects 0085 new_ao = ao (conj_data, h); 0086 new_ao = setnh(new_ao, 'name', sprintf('conj(%s)',invars{j}) ); 0087 0088 % add to output 0089 bs = [bs new_ao]; 0090 0091 end 0092 0093 % Reshape the ouput to the same size of the input 0094 varargout{1} = reshape(bs, size(as)); 0095 0096 %% Get default params 0097 function plo = getDefaultPL() 0098 plo = plist(); 0099 0100 % END