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

Home » Public Forums » archive » Re: Very slow IDL vs Matlab (ascii file reading)
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: Very slow IDL vs Matlab (ascii file reading) [message #36887 is a reply to message #36883] Wed, 05 November 2003 04:38 Go to previous messageGo to previous message
Richard French is currently offline  Richard French
Messages: 173
Registered: December 2000
Senior Member
OK, I figured out a work-around using STRSPLIT:

; write the data file

x=make_array(/double,value=999.d0,660L*496L)
w=17L*660L*496L
openw,lun,/get_lun,'Mydata.dat',width=w
PRINTF,lun,x
free_lun,lun
; read the file as a single string
s=''
openr,lun,'Mydata.dat',/get_lun
readf,lun,s
IDL> help,s
S STRING = ' 999.00000 999.00000
999.000'...
free_lun,lun
;convert the long string to desired floating point array
Data=fltarr(660,496)
Reads,strsplit(s,/EXTRACT),data

This is fast, and should do what you need without having to split the file
itself in to shorter lines. You can do it all in IDL.


Dick French
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: How to solve a homogeneous system(Ax=0) with a gauss elimination method that x is not zero.
Next Topic: Simple seismic ray tracing code?

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

Current Time: Wed Oct 08 20:07:46 PDT 2025

Total time taken to generate the page: 0.00471 seconds