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

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

[Octave-bug-tracker] [bug #60711] textscan with '.' char read as float


From: Paul Netsaver
Subject: [Octave-bug-tracker] [bug #60711] textscan with '.' char read as float
Date: Mon, 31 May 2021 09:36:01 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?60711>

                 Summary: textscan with '.' char read as float
                 Project: GNU Octave
            Submitted by: netsaver
            Submitted on: Mon 31 May 2021 01:35:59 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Netsaver Paul
        Originator Email: 
             Open/Closed: Open
                 Release: 6.2.0
         Discussion Lock: Any
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

According to matlab, _textscan_ function "stops when it cannot match
formatSpec to the data."
While writing a wrapper for textscan in my application, I could see that the
char '.' (alone), when matched with a float with '%f' specifier, is read as
'NaN', letting the scan continue.
In matlab it doesn't match with '%f', stopping the scan at that position.
Here the text in the first parameter position emulates a file with 'eol'
chars, but the results were the same with a real file...

q=textscan([',,.',newline,',,'],'%f','delimiter',',')
q{:}
matlab: NaN NaN
octave: q =
{
  [1,1] =

     NaN
     NaN
     NaN
     NaN
     NaN

}


the 3rd nan matches the '.' char
Note that (as with matlab), empty values before the delimiter are converted to
NaN, while empty values after the delimiter and before the eol are not
converted to nan (but does not stop the scan).

Marked as Matlab compatibility issue, but don't know if wanted or not.

regards,
Netsaver





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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