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

Home » Public Forums » archive » Re: Question about structure I/O in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Question about structure I/O in IDL [message #11095] Sat, 14 March 1998 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Marcus E Engdahl (mengdahl@alpha.hut.fi) writes:

> I read my data from ASCII-files using READ_ASCII which uses templates to
> define the format of the ASCII-file. The templates are structures created
> by ASCII_TEMPLATE. Since most of my ASCII-files have the same format, I'd
> like to store these structures into disk. How do I do this?
>
> Is this the right way to store it?
>
> template = ASCII_TEMPLATE(cohfilename)
> OPENW,1,'template,file'
> WRITEU,1,template
> CLOSE,1
>
> Storing seems to work alright but when I try to read the structure using
> READU I run into problems (template doesn't become a structure).
>
> OPENR,1,'template.file'
> READU,1,template
> CLOSE,1
>
> What is the correct way to store and retrieve structures?

In this situation, I think the easiest thing to do would
be to use the SAVE and RESTORE commands to save the file
template. The code might look like this:

template = ASCII_TEMPLATE(filename)
Save, template, File='template.sav'

When you want it again:

Restore, 'template.sav'
data = Read_ASCII('newfilename', Template=template)

Cheers,

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: 16-bit tiffs
Next Topic: Re: ASSOC and structures don't mix

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

Current Time: Fri Oct 10 00:45:31 PDT 2025

Total time taken to generate the page: 0.55779 seconds