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

Home » Public Forums » archive » ascii-template
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: ascii-template [message #44195 is a reply to message #44137] Sun, 22 May 2005 12:14 Go to previous message
Justin[4] is currently offline  Justin[4]
Messages: 2
Registered: March 2005
Junior Member
If your files are reasonably simple (space or tab delimited) I would
avoid the use of ascii_template altogether and use a structure to define
what each line looks like, replicate the line and readf it into an array.
E.g. for 4 columns (3 integers and a float) use:

line = {year:0, month:0, day:0, temperature:0.0}
num_lines = 1000 ; Could use file_lines or similar to count the lines here
data = REPLICATE(line, num_lines) ;Make array to hold data
OPENR, lun, filename, /GET_LUN
READF, lun, data ;Read in all the data
FREE_LUN, lun ;Close file

PRINT, data[100].temperature ; Print the 101st temp

Then as your file changes just change the definition of the line
structure. Of course if you have a complicated file structure you'll need
to stick with the flexibility (and complexity) of READ_ASCII.

HTH

Justin


On Wed, 18 May 2005 12:01:32 +0200, Lasse Clausen wrote:

> greetings.
> in the course of my work this format of the ascii data file changes. new
> columns appear, other columns disappear. everytime that happens i have to
> use my SAVE_ASCII_TEMPLATE function to make a whole new template which is
> annoying if the data file now contains 25 columns instead of 26 because i
> have to type in the names of the 25 columns again although they haven't
> changed.
[Message index]
 
Read Message
Read Message
Previous Topic: Re: LabView script node and NetCDF
Next Topic: Re: converting floats to doubles

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

Current Time: Fri Oct 10 02:49:55 PDT 2025

Total time taken to generate the page: 0.79515 seconds