1% CTRANSPOSE [overload base function]
2
3% Copyright Notice
4%
5%    Copyright (C) 2013 SUPELEC
6%
7%    Author:  Julien Bect  <julien.bect@centralesupelec.fr>
8
9% Copying Permission Statement
10%
11%    This file is part of
12%
13%            STK: a Small (Matlab/Octave) Toolbox for Kriging
14%               (http://sourceforge.net/projects/kriging)
15%
16%    STK is free software: you can redistribute it and/or modify it under
17%    the terms of the GNU General Public License as published by the Free
18%    Software Foundation,  either version 3  of the License, or  (at your
19%    option) any later version.
20%
21%    STK is distributed  in the hope that it will  be useful, but WITHOUT
22%    ANY WARRANTY;  without even the implied  warranty of MERCHANTABILITY
23%    or FITNESS  FOR A  PARTICULAR PURPOSE.  See  the GNU  General Public
24%    License for more details.
25%
26%    You should  have received a copy  of the GNU  General Public License
27%    along with STK.  If not, see <http://www.gnu.org/licenses/>.
28
29function y = ctranspose(x)
30
31rn = get(x, 'rownames');
32cn = get(x, 'colnames');
33
34y = stk_dataframe(ctranspose(x.data), rn', cn');
35
36end % function
37
38% note: complex-valued dataframes are supported but, currently,
39%       not properly displayed
40
41%!test
42%! u = rand(3, 2) + 1i * rand(3, 2);
43%! data = stk_dataframe(u, {'x' 'y'}, {'obs1'; 'obs2'; 'obs3'});
44%! data = data';
45%! assert (isa(data, 'stk_dataframe') && isequal(double(data), u'));
46%! assert (isequal(data.rownames, {'x'; 'y'}));
47%! assert (isequal(data.colnames, {'obs1' 'obs2' 'obs3'}));
48