Home > classes > @ao > ctranspose.m

ctranspose

PURPOSE ^

CTRANSPOSE overloads the ' operator for Analysis Objects.

SYNOPSIS ^

function varargout = ctranspose(varargin)

DESCRIPTION ^

 CTRANSPOSE overloads the ' operator for Analysis Objects.

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

 DESCRIPTION: CTRANSPOSE overloads the ' operator for Analysis Objects.

 CALL:        a = a1'    % only with data = cdata

 VERSION:     $Id: ctranspose.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 = ctranspose(ao, 'Params')

 HISTORY: 08-05-07 A Monsky
             Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

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

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