comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: [Q] Reading from file, speed
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: [Q] Reading from file, speed [message #18913 is a reply to message #18911] Thu, 10 February 2000 00:00 Go to previous message
Ivan Zimine is currently offline  Ivan Zimine
Messages: 40
Registered: February 1999
Member
Hi,

you don't need the loops
try this

ms = bytarr(dimx,dimy,dimz)
openr, lun, ms_dat_file, /get_lun
readu, lun, ms
free_lun, lun

hope this helps

Ivan

Koen Janssens wrote:
>
> I am looking for a better way to import data into IDL, the one I am
> using now seems very slow (about 20 secs for reading in 2 MBytes). Here
> is the script that I use:
>
> openr, ms_dat_unit, ms_dat_file
> ms = bytarr(dimx,dimy,dimz)
> for z = 0,(dimz-1) do begin
> for y = 0,(dimy-1) do begin
> for x = 0,(dimx-1) do begin
> readu, ms_dat_unit, tmp
> ms[x,y,z] = tmp
> endfor
> endfor
> endfor
> close, ms_dat_unit
> free_lun, ms_dat_unit
>
> The file I am reading contains integers in binary format (volume data
> 128^3).
>
> Any help is appreciated.
> Koen

--
Ivan Zimine
Dpt. of Radiology, Geneva University Hospitals
email: ivan.zimine@physics.unige.ch
tel. : (+41 22) 372 70 70
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Error Handling, Was: Passing optional parameters
Next Topic: [Q] Reading from file, speed

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 07:01:37 PDT 2025

Total time taken to generate the page: 0.47912 seconds