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

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

[Octave-bug-tracker] [bug #53277] textscan(...) does not parse sequence


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #53277] textscan(...) does not parse sequence of integers separated by dots (.)
Date: Sun, 4 Mar 2018 16:05:46 -0500 (EST)
User-agent: Mozilla/5.0 (Linux; Android 7.0; SM-T585 Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.107 Safari/537.36

Follow-up Comment #5, bug #53277 (project octave):

@ comment #3
Surely this is unexpected behavior, I already wrote that bug-compatibility
*may* be at play here. The actual issue is probably that strread.m (behind the
old textscan.m in Octave 4.0.3 and luckily still present in 4.3+) can handle
cuddling literals (the "." in your example) while textscan and Matlab's
textscan and strread.m can't; they can only process literals surrounded by
whitespace and/or delimiters.
OTOH chances are that if the behavior is changed, someone else will complain
that his/her Matlab code won't run in Octave. I'm not the one to decide which
argument should be leading.

Your implicit analysis that textscan in both Octave and the proprietary
competition probably first reads doubles and later on casts them to int32
looks valid enough. The old textscan, in fact strread.m, first splits up the
input into tokens along the delimiters, literals (in your case ".") and
whitespace, only then tries to read numbers from the tokens alone, so that may
explain a few things.
My own opinion is that Matlab's textscan has acquired quite a bit of
overweight as far as functionality goes, it has so many options that gotchas
like this one are IMO simply unavoidable and maybe even not fixable.


Anyway, I can't fix it, textscan is a binary function now and my C/C++ skills
are insufficient. FYI there are several open bug reports for textscan ATM.
Please remember Octave is open source, you're free to try to come up with a
fix yourself, we don't take orders, but sometimes take gentle nudges.

@ comment #4: 
Try textread.m (a fid front-end for stread.m)
Alternatives that work for relatively homogeneous files are dlmread and
csv2cell.

BTW I'll file a bug report about Matlab's textscan with TMW. However my
experience with that is not favorable, usually they just change their docs.

Cc'ing Rik, let's await his opinion.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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