Seems like my files also contained blank lines periodically. I added blank line removal to the sed script and now it all works. Thanks a lot!
On Friday, July 18, 2014 2:35:18 PM UTC+2, Mauro wrote: > > on julia0.3 this works: > > julia> readdlm("fl") > 3x3 Array{Float64,2}: > -70.0 -70.0 3.0982e-10 > -69.4531 -70.0 2.54816e-10 > -68.9063 -70.0 2.23406e-10 > > julia> readdlm("fl", Float64) > 3x3 Array{Float64,2}: > -70.0 -70.0 3.0982e-10 > -69.4531 -70.0 2.54816e-10 > -68.9063 -70.0 2.23406e-10 > > > > On Fri, 2014-07-18 at 13:15, Andrei Berceanu <andreib...@gmail.com > <javascript:>> wrote: > > Here is 1 line from one of my files, after sed-magic: > > > > -70.0000000000000 -70.0000000000000 3.098203380460164E-010 > > -69.4531250000000 -70.0000000000000 2.548160684589544E-010 > > -68.9062500000000 -70.0000000000000 2.234061987906998E-010 > > > > There are 2 spaces at the start of each line and then the column are > > separated by spaces as well. > > I tried > > > > readdlm(pumppath, ' ', Float64, '\n') > > > > and get > > > > file entry "" cannot be converted to Float64 > > > > > > > > On Friday, July 18, 2014 1:57:00 PM UTC+2, Mauro wrote: > >> > >> > Space is an issue, yes, but I agree, I can process them one by one > using > >> > some sed scripting. I just thought there is a simple idiom > corresponding > >> to > >> > Python's 2-liner above. > >> > In fact, I am wondering, how difficult would it be to make julia > accept > >> the > >> > Fortran double precision format natively - is that a big change in > Base? > >> > >> I had a look: base/datafmt.jl does the file reading but it is quite > >> cryptic and I didn't quite figure out where the conversion from string > >> to float occurs. But probably it's done with the float64 function in > >> base/string.jl which calls into C: src/builtins.c function jl_strtod. > >> So, if my digging is right then it's not so easy to change and would > >> change how strings are parsed into floats everywhere. > >> > >> Thus probably easiest to write a function which does the parsing. > >> > >> > On a separate issue, is there an equivalent to numpy's *loadtxt*? > >> > >> readdlm or readcsv do this. How did you do it? > >> > >> > > -- >