Here are a few lines from one of my files, after sed preprocessing:

  -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? 
>
>

Reply via email to