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

Re: Help with reading structure from file



Sure does work, Martin :-)

;**************************
pro test
buffer = {a : '', b: fltarr(7)}
result = replicate(buffer, 6)
temp = dialog_pickfile()
; Pick the file with Surendar's data
openr, unit, temp, /get_lun
readf, unit, result, format='(4x,a4,7f9.3)'
free_lun, unit
; No need in subscripting
help, result.(1)
end
;**************************

Cheers,
Pavel

Martin Schultz wrote:
> 
> The solution is to use a structure. SOmething like this (no time for
> testing though):
> 
>    template = { a:'', x:fltarr(7) }
>    result = replicate(template, NLINES)
>    readf, lun, result, format='(4x,a4,7f9.3)'
> 
>    data = result[*].x   ; not sure if this even works ;-(
> 
> Hope this helps you a little bit,
> 
> Martin