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

Home » Public Forums » archive » Re: String Data file
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: String Data file [message #35849 is a reply to message #35848] Thu, 31 July 2003 10:46 Go to previous messageGo to previous message
Justin[2] is currently offline  Justin[2]
Messages: 16
Registered: October 2002
Junior Member
Use structures. In fact always use structures for everything because
Structures Are Your Friends. They'll make your programs elegant.

;Use a structure to specify that each line is a string and two floats
line = {col1:"a string", col2:0.0, col3:0.0}
num_lines = 100
;Make an array of structures
data = REPLICATE(line, num_lines)
OPENR, lun, 'yourfile.dat', /GET_LUN
;Read in all the data in one go
READF, lun, data
FREE_LUN, lun
;Print out some of the data
PRINT, data[5].col1, data[7:9].col2, data.col3



Karthikayan Balakrishnan wrote:
> Hello All,
> I have a data file that looks like this:
> abc 1 2
> def 3 4.5
> ghij 2.3 23.44
> ...
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: BOX_CURSOR
Next Topic: minor glitch in total()

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

Current Time: Wed Oct 08 18:43:45 PDT 2025

Total time taken to generate the page: 0.00434 seconds