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

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

[Octave-bug-tracker] [bug #50619] textscan weird behaviour when reading


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #50619] textscan weird behaviour when reading a csv
Date: Thu, 23 Mar 2017 19:43:22 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46

Update of bug #50619 (project octave):

                  Status:                    None => Confirmed              
                 Release:                   4.2.1 => dev                    
        Operating System:       Microsoft Windows => Any                    

    _______________________________________________________

Follow-up Comment #2:

Confirmed on Windows 7 with Octave-4.3.0+
An intriguing bug.
I checked with Matlab r2017a but that does not portray this bug.

AFAICS, by starting with "h" for the last field on line 1 and adding
characters, trouble starts as soon as the "[" (in fact, any character) is
added after the trailing space after "heading".  Then textscan starts reading
in the middle of the "44.0000000000000" field (correctly at the faulty pos1
position) and gets out of sync, evidenced by the NaN (= missing value for
empty field).
Adding a <'whitespace', ''> arg in the textscan call makes no difference.
Textcan correctly reads the last field on line 1 in all cases. So it is the
file pointer computation that gets confused.

BTW
As a workaround you can also try to read the csv-file using csv2cell in the io
package (I just tried). As of io-2.4.6 (now silently updated to 2.4.7)
csv2cell accepts a spreadsheet-style address argument, see "help csv2cell".

>> C = csv2cell ('bug50619.csv', ';')
C =
{
  [1,1] = time [s]
  [2,1] =  5.2500
  [1,2] = lat [deg]
  [2,2] =  44
  [1,3] = lon [deg]
  [2,3] =  10
  [1,4] = x [m]
  [2,4] = 0
  [1,5] = y [m]
  [2,5] = 0
  [1,6] = speed [m/s]
  [2,6] = 0
  [1,7] = heading [deg]
  [2,7] =  44.998
}



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?50619>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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