octave-maintainers
[Top][All Lists]
Advanced

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

Re: C++ implemntation of textscan


From: PhilipNienhuis
Subject: Re: C++ implemntation of textscan
Date: Mon, 26 Oct 2015 23:54:40 -0700 (PDT)

LachlanA wrote
> In the test suite, I commented out one which Matlab also fails (a format
> like "foo%dfoo" on the string "foofoo" -- Matlab and my code don't treat
> this as NaN, since "foo" isn't a delimiter).

1. NaN with format string "foo%ffoo"?  Octave:

>> strread ("foofoo", "foo%dfoo")
ans = 0
>> strread ("foofoo", "foo%ffoo")
ans = NaN
>>
(and of course textscan.m then merely makes a cell array of it.)

2. Yeah, Matlab's textscan doesn't like literals immediately following (or
preceding) text or numeric fields. I quite wouldn't mind if Octave's
textscan were to perform better :-)  (it did already in several respects).
However, trying to mimic strread's current behavior there could become a
complicated exercise. Literals immediately preceding ("cuddling") an output
field are easy. It gets messy for trailing literals that -like in your
example- can follow a missing output field. strread.m looks ahead to the
next field then to determine where to cut the current field. That may slow
things down a bit.
But maybe we shouldn't be too ambitious in the starting phase :-)  FYI, I
fixed some strread.m bugs relating to this very situation only some months
ago.

I really like your multi-character delimiters option - didn't know that
Matlab had it too (does it?). I had that working at one time as well in
strread.m (to be able to read mixed .csv files, using {'",',  '","',  ',"'}
as delimiters, but then I discovered csv2cell().

Philip




--
View this message in context: 
http://octave.1599824.n4.nabble.com/C-implemntation-of-textscan-tp4673127p4673149.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.



reply via email to

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