textread() barfs silently when file contains "nan" or "inf"
Rob Mahurin
rob at utk.edu
Wed Aug 13 14:06:14 CDT 2008
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.
Cheers,
Rob
--
Rob Mahurin
Dept. of Physics & Astronomy
University of Tennessee phone: 865 207 2594
Knoxville, TN 37996 email: rob at utk.edu
More information about the Bug-octave
mailing list