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.html,v 1.14 2008/03/31 10:27:33 hewitson Exp $

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

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

 The following call returns a string that contains the routine CVS version:

 >> version = ctranspose(ao,'Version')

 The following call returns a string that contains the routine category:

 >> category = ctranspose(ao,'Category')

 HISTORY: 08-05-07 A Monsky
             Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function varargout = ctranspose(varargin)
0002 % CTRANSPOSE overloads the ' operator for Analysis Objects.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: CTRANSPOSE overloads the ' operator for Analysis Objects.
0007 %
0008 % CALL:        a = a1'    % only with data = cdata
0009 %
0010 % VERSION:     $Id: ctranspose.html,v 1.14 2008/03/31 10:27:33 hewitson Exp $
0011 %
0012 % The following call returns a parameter list object that contains the
0013 % default parameter values:
0014 %
0015 % >> pl = ctranspose(ao, 'Params')
0016 %
0017 % The following call returns a string that contains the routine CVS version:
0018 %
0019 % >> version = ctranspose(ao,'Version')
0020 %
0021 % The following call returns a string that contains the routine category:
0022 %
0023 % >> category = ctranspose(ao,'Category')
0024 %
0025 % HISTORY: 08-05-07 A Monsky
0026 %             Creation
0027 %
0028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0029 
0030 VERSION  = '$Id: ctranspose.html,v 1.14 2008/03/31 10:27:33 hewitson Exp $';
0031 CATEGORY = 'Operator';
0032 bs       = [];
0033 
0034 %% Check if this is a call for parameters
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   d = get(a, 'data');
0072   dinfo = whos('d');
0073   % Which data type do we have
0074   dtype = dinfo.class;
0075 
0076   switch dtype
0077     case 'cdata'
0078 %       disp('* CTRANSPOSE of cdata object');
0079       % make a new cdata object
0080       [h, c] = single_operation(d, 'ctranspose', pl);
0081 
0082       % make output analysis object
0083       h = set(h, 'inhists', [a.hist]);
0084 
0085       %% Set the var_name to the history
0086       h = set(h, 'invars', cellstr(invars{j}));
0087 
0088       b = ao(c, h);
0089       b = setnh(b, 'name',  sprintf('ctranspose(%s)', char(invars{j})));
0090 
0091     case {'tsdata','fsdata','xydata'}
0092       error('### this function works for cdata type AO only')
0093     otherwise
0094       error('### unknown data type.')
0095 
0096   end
0097 
0098   % add to output
0099   bs = [bs b];
0100 end
0101 
0102 % Reshape the ouput to the same size of the input
0103 bs = reshape(bs, size(as));
0104 varargout{1} = bs;
0105 
0106 %% Get default params
0107 function plo = getDefaultPL()
0108 
0109 plo = plist();
0110 
0111 % END

Generated on Mon 31-Mar-2008 12:20:24 by m2html © 2003