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.12 2007/11/26 14:48:13 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.12 2007/11/26 14:48:13 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.12 2007/11/26 14:48:13 ingo Exp $';
0023 bs      = [];
0024 
0025 %% Check if this is a call for parameters
0026 
0027 if nargin == 2
0028   if isa(varargin{1}, 'ao') && ischar(varargin{2})
0029     in = char(varargin{2});
0030     if strcmp(in, 'Params')
0031       varargout{1} = getDefaultPL();
0032       return
0033     elseif strcmp(in, 'Version')
0034       varargout{1} = VERSION;
0035       return
0036     end
0037   end
0038 end
0039 
0040 %% Collect input ao's, plist's and ao variable names
0041 in_names = {};
0042 for ii = 1:nargin
0043   in_names{end+1} = inputname(ii);
0044 end
0045 
0046 [as, ps, invars] = collect_inputs(varargin, in_names);
0047 
0048 % check plist
0049 if isempty(ps)
0050   pl = getDefaultPL();
0051 else
0052   pl = combine(ps, getDefaultPL);
0053 end
0054 
0055 %create empty plist
0056 plo = plist();
0057 
0058 %% go through analysis objects
0059 for j=1:numel(as)
0060   a = as(j);
0061   d = get(a, 'data');
0062   dinfo = whos('d');
0063 
0064   % Which data type do we have
0065   dtype = dinfo.class;
0066 
0067   switch dtype
0068     case 'cdata'
0069       disp('* TRANSPOSE of cdata object');
0070       % make a new cdata object
0071       [h, c] = single_operation(d, 'transpose', pl);
0072 
0073       % make output analysis object
0074       h = set(h, 'inhists', [a.hist]);
0075 
0076       %% Set the var_name to the history
0077       h = set(h, 'invars', cellstr(invars{j}));
0078 
0079       b = ao(c, h);
0080       b = setnh(b, 'name',  sprintf('transpose(%s)', char(invars{j})));
0081 
0082     case {'tsdata','fsdata','xydata'}
0083       error('### this function works for cdata type AO only')
0084     otherwise
0085       error('### unknown data type.')
0086 
0087   end
0088 
0089   % add to output
0090   bs = [bs b];
0091 end
0092 
0093 % Reshape the ouput to the same size of the input
0094 bs = reshape(bs, size(as));
0095 varargout{1} = bs;
0096 
0097 %% Get default params
0098 function plo = getDefaultPL()
0099 
0100 plo = plist();
0101 
0102 % END

Generated on Tue 22-Jan-2008 10:39:13 by m2html © 2003