octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #54661] textscan() continues from next line if


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #54661] textscan() continues from next line if line ends with delimiter
Date: Fri, 14 Sep 2018 17:17:46 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Follow-up Comment #2, bug #54661 (project octave):

There is an "EndOfLine" option to textscan, so one would think that it should
fill in NaN when there aren't enough columns.  That definitely seems like a
bug to me.

As an alternative for you, rather than creating cells since your data file is
rather uniform in its elements, you might want to try dlmread():


octave:17> data = dlmread('bug_example.txt', 'emptyvalue', NaN)
data =

     1     2     3     4
     5     6     7     8
     9    10   NaN   NaN
    13    14    15    16


which appears to work properly and gives you a nice matrix to work with if
that is what you eventual want.  (As opposed to stitching together a bunch of
cell columns.)

So there is the original bug reported.  Also, I'd like to add that the above
dlmread() routine requires that 'emptyvalue' be all lower case.  That is, it
doesn't accept 'EmptyValue':


octave:18> data = dlmread('bug_example.txt', 'EmptyValue', NaN)
error: dlmread: error parsing RANGE


Should we change that to accept EmptyValue and be consistent with routines
like textscan?

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?54661>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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