Home > classes > @ao > transpose.m

transpose

PURPOSE ^

TRANSPOSE overloads the .' operator for Analysis Objects.

SYNOPSIS ^

function varargout = transpose(varargin)

DESCRIPTION ^

 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.10 2007/09/27 09:03:25 ingo Exp $

              The following call returns a parameter list object that
              contains the default parameter values:

              >> pl = transpose(ao, 'Params')

 HISTORY: 08-05-07 A Monsky
             Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

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

Generated on Fri 02-Nov-2007 19:39:27 by m2html © 2003