help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

inconsistent results between textread and load


From: kamaraju kusumanchi
Subject: inconsistent results between textread and load
Date: Sat, 15 Nov 2014 13:02:14 -0500

It looks like the same data file is read in different ways by textread
and load. Is this intentional? If not, can we make the default
behaviour consistent?

Consider the following two data files

address@hidden:~/x$ cat data.txt
1.0 2.0 NaN 3.0 4.0
address@hidden:~/x$ cat data2.txt
1.0 2.0 NA 3.0 4.0

address@hidden:~/x$ octave -q
octave:1> a = textread("data.txt"); a
a =

     1
     2
   NaN
     3
     4

octave:2> a = load("data.txt"); a
a =

     1     2   NaN     3     4

So textread is reading it as a 5x1 vector while load is reading it as
1x5 vector.

octave:3> a = load("data2.txt"); a
error: value on right hand side of assignment is undefined
octave:3> a = textread("data2.txt"); a
a =

     1
     2
    NA
     3
     4

So 'load' is not able to handle NA but 'textread' is.

octave:5> address@hidden:~/x$ dpkg -l octave\* | grep ^ii
ii  octave                3.8.2-2      amd64        GNU Octave
language for numerical computations
ii  octave-common         3.8.2-2      all
architecture-independent files for octave
ii  octave-control        2.6.2-1+b1   amd64        control functions
for Octave from Octave-Forge
ii  octave-doc            3.8.1-3      all          PDF documentation
on the GNU Octave language
ii  octave-general        1.3.4-1      amd64        provide extra
general functions for Octave
ii  octave-info           3.8.1-3      all          GNU Info
documentation on the GNU Octave language
ii  octave-io             2.0.2-1      amd64        input/output data
functions for Octave
ii  octave-signal         1.3.0-1      amd64        signal processing
functions for Octave
ii  octave-statistics     1.2.3-1      all          additional
statistical functions for Octave

raju
-- 
Kamaraju S Kusumanchi
http://malayamaarutham.blogspot.com/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]