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