]> Creatis software - CreaPhase.git/blob - octave_packages/dataframe-0.9.1/@dataframe/private/df_whole.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / dataframe-0.9.1 / @dataframe / private / df_whole.m
1 function resu = df_whole(df);
2
3   %# function resu = df_whole(df)
4   %# Generate a full matrix from a column-compressed version of a dataframe.
5
6   %% Copyright (C) 2009-2012 Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
7   %%
8   %% This file is part of Octave.
9   %%
10   %% Octave is free software; you can redistribute it and/or
11   %% modify it under the terms of the GNU General Public
12   %% License as published by the Free Software Foundation;
13   %% either version 2, or (at your option) any later version.
14   %%
15   %% Octave is distributed in the hope that it will be useful,
16   %% but WITHOUT ANY WARRANTY; without even the implied
17   %% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18   %% PURPOSE.  See the GNU General Public License for more
19   %% details.
20   %%
21   %% You should have received a copy of the GNU General Public
22   %% License along with Octave; see the file COPYING.  If not,
23   %% write to the Free Software Foundation, 51 Franklin Street -
24   %% Fifth Floor, Boston, MA 02110-1301, USA.
25   
26   %#
27   %# $Id: df_whole.m 9585 2012-02-05 15:32:46Z cdemills $
28   %#
29
30   inds = max(cellfun(@length, df._rep));
31
32   resu = df._data{1}(:, df._rep{1});
33   if (inds > 1),
34     resu = reshape(resu, df._cnt(1), 1, []);
35     if (1 == size(resu, 3)),
36       resu = repmat(resu, [1 1 inds]);
37     endif
38   endif
39
40   if df._cnt(2) > 1,
41     resu = repmat(resu, [1 df._cnt(2)]);
42     for indi = 2:df._cnt(2),
43       dummy = df._data{indi}(:, df._rep{indi});
44       if (inds > 1),
45         dummy = reshape(dummy, df._cnt(1), 1, []);
46         if (1 == size(dummy, 3)),
47           dummy = repmat(dummy, [1 1 inds]);
48         endif
49       endif
50       resu(:, indi, :) = dummy;
51     endfor
52   endif
53
54 endfunction