TRANSPOSE overloads the .' operator for Analysis Objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: TRANSPOSE overloads the .' operator for Analysis Objects. CALL: a = a1.' % only with data = cdata VERSION: $Id: transpose.m,v 1.14 2008/02/12 10:11:13 mauro Exp $ The following call returns a parameter list object that contains the default parameter values: >> pl = transpose(ao,'Params') The following call returns a string that contains the routine CVS version: >> version = transpose(ao,'Version') The following call returns a string that contains the routine category: >> category = transpose(ao,'Category') HISTORY: 08-05-07 A Monsky Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = transpose(varargin) 0002 % TRANSPOSE overloads the .' operator for Analysis Objects. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: TRANSPOSE overloads the .' operator for Analysis Objects. 0007 % 0008 % CALL: a = a1.' % only with data = cdata 0009 % 0010 % VERSION: $Id: transpose.m,v 1.14 2008/02/12 10:11:13 mauro Exp $ 0011 % 0012 % The following call returns a parameter list object that contains the 0013 % default parameter values: 0014 % 0015 % >> pl = transpose(ao,'Params') 0016 % 0017 % The following call returns a string that contains the routine CVS version: 0018 % 0019 % >> version = transpose(ao,'Version') 0020 % 0021 % The following call returns a string that contains the routine category: 0022 % 0023 % >> category = transpose(ao,'Category') 0024 % 0025 % 0026 % HISTORY: 08-05-07 A Monsky 0027 % Creation 0028 % 0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0030 0031 VERSION = '$Id: transpose.m,v 1.14 2008/02/12 10:11:13 mauro Exp $'; 0032 CATEGORY = 'Operator'; 0033 0034 bs = []; 0035 0036 %% Check if this is a call for parameters 0037 0038 if nargin == 2 0039 if isa(varargin{1}, 'ao') && ischar(varargin{2}) 0040 in = char(varargin{2}); 0041 if strcmp(in, 'Params') 0042 varargout{1} = getDefaultPL(); 0043 return 0044 elseif strcmp(in, 'Version') 0045 varargout{1} = VERSION; 0046 return 0047 elseif strcmp(in, 'Category') 0048 varargout{1} = CATEGORY; 0049 return 0050 end 0051 end 0052 end 0053 0054 %% Collect input ao's, plist's and ao variable names 0055 in_names = {}; 0056 for ii = 1:nargin 0057 in_names{end+1} = inputname(ii); 0058 end 0059 0060 [as, ps, invars] = collect_inputs(varargin, in_names); 0061 0062 % check plist 0063 if isempty(ps) 0064 pl = getDefaultPL(); 0065 else 0066 pl = combine(ps, getDefaultPL); 0067 end 0068 0069 %create empty plist 0070 plo = plist(); 0071 0072 %% go through analysis objects 0073 for j=1:numel(as) 0074 a = as(j); 0075 d = get(a, 'data'); 0076 dinfo = whos('d'); 0077 0078 % Which data type do we have 0079 dtype = dinfo.class; 0080 0081 switch dtype 0082 case 'cdata' 0083 %disp('* TRANSPOSE of cdata object'); 0084 % make a new cdata object 0085 [h, c] = single_operation(d, 'transpose', pl); 0086 0087 % make output analysis object 0088 h = set(h, 'inhists', [a.hist]); 0089 0090 %% Set the var_name to the history 0091 h = set(h, 'invars', cellstr(invars{j})); 0092 0093 b = ao(c, h); 0094 b = setnh(b, 'name', sprintf('transpose(%s)', char(invars{j}))); 0095 0096 case {'tsdata','fsdata','xydata'} 0097 error('### this function works for cdata type AO only') 0098 otherwise 0099 error('### unknown data type.') 0100 0101 end 0102 0103 % add to output 0104 bs = [bs b]; 0105 end 0106 0107 % Reshape the ouput to the same size of the input 0108 bs = reshape(bs, size(as)); 0109 varargout{1} = bs; 0110 0111 %% Get default params 0112 function plo = getDefaultPL() 0113 0114 plo = plist(); 0115 0116 % END