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.13 2007/12/21 10:41:32 hewitson 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 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.m,v 1.13 2007/12/21 10:41:32 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 % HISTORY: 08-05-07 A Monsky
0018 %             Creation
0019 %
0020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0021 
0022 VERSION = '$Id: ctranspose.m,v 1.13 2007/12/21 10:41:32 hewitson 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 %% go through analysis objects
0056 for j=1:numel(as)
0057   a = as(j);
0058 
0059   d = get(a, 'data');
0060   dinfo = whos('d');
0061   % Which data type do we have
0062   dtype = dinfo.class;
0063 
0064   switch dtype
0065     case 'cdata'
0066 %       disp('* CTRANSPOSE of cdata object');
0067       % make a new cdata object
0068       [h, c] = single_operation(d, 'ctranspose', pl);
0069 
0070       % make output analysis object
0071       h = set(h, 'inhists', [a.hist]);
0072 
0073       %% Set the var_name to the history
0074       h = set(h, 'invars', cellstr(invars{j}));
0075 
0076       b = ao(c, h);
0077       b = setnh(b, 'name',  sprintf('ctranspose(%s)', char(invars{j})));
0078 
0079     case {'tsdata','fsdata','xydata'}
0080       error('### this function works for cdata type AO only')
0081     otherwise
0082       error('### unknown data type.')
0083 
0084   end
0085 
0086   % add to output
0087   bs = [bs b];
0088 end
0089 
0090 % Reshape the ouput to the same size of the input
0091 bs = reshape(bs, size(as));
0092 varargout{1} = bs;
0093 
0094 %% Get default params
0095 function plo = getDefaultPL()
0096 
0097 plo = plist();
0098 
0099 % END

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