textread() barfs silently when file contains "nan" or "inf"
John W. Eaton
jwe at bevo.che.wisc.edu
Thu Aug 21 13:08:25 CDT 2008
On 13-Aug-2008, Rob Mahurin wrote:
| running octave 3.0.1.
|
| file "bug.txt" contains
| 0.090 015.0 013.9 20.456 15.3822 60.7908
| 0.088 015.0 NaN 20.486 15.3438 60.7438
| 0.086 015.0 013.8 20.494 15.2289 60.5916
|
| from octave:
| [c1,c2,c3,c4,c5,c6] = textread("bug.txt","%f %f %f %f %f %f");
| [c1,c2,c3,c4,c5,c6]
| ans =
|
| 0.090000 15.000000 13.900000 20.456000 15.382200
| 60.790800
| 0.088000 15.000000 15.000000 15.000000 15.000000
| 15.000000
| 0.086000 15.000000 13.800000 20.494000 15.228900
| 60.591600
|
| So, reading "nan" or "inf" (or other invalid input) stops processing
| for the current line without throwing an error.
|
| Quick fix: detect and complain about error
| Better fix: support nan and inf, document
|
| I forget whether textread() is an octave-forge function, and whether
| this is the right mailing list if so. Sorry.
It is part of the Octave Forge io package.
jwe
More information about the Bug-octave
mailing list