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

Home » Public Forums » archive » Re: Can you do 'unions' with pv-wave?
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: Can you do 'unions' with pv-wave? [message #3179 is a reply to message #3177] Mon, 21 November 1994 17:08 Go to previous message
hahn is currently offline  hahn
Messages: 108
Registered: November 1993
Senior Member
In article <1994Nov19.012318.9400@mksol.dseg.ti.com> jgavin@mksol.dseg.ti.com (Jeffrey S. Gavin) writes:
> From: jgavin@mksol.dseg.ti.com (Jeffrey S. Gavin)
> Subject: Can you do 'unions' with pv-wave?
> Date: Sat, 19 Nov 1994 01:23:18 GMT

> Is there a way to have a single variable viewed as multiple types, similar
> to the way unions work in C. For example:

[example deleted]

> Our brute-force approach is to read the 50MB file in once as an array of bytes, then again as an array of int, float, then double. This takes time and space
> when actually, we simply want to view the same exact data in different ways.
> Again, the 'C' union structure is the best way I can describe the problem.

> Thanks for any help.

> Regards,

> Jeff


> --
> Jeff Gavin Jeff.Gavin@dseg.ti.com
> Texas Instruments MSG: JGAV / (214) 462-5496

The predefined approach to this problem is to read the data in pieces into a
string array or string and use reads to retrieve data from the string using a
fortran style format. Example (not tested) which assumes your data file on disk
is open:

temp_s = String ('*', format='(A200)') ; declare a 200 byte string
c2 = '**' ; declare a 2 byte character item
i2 = 0 ; declare a short integer variable

readu, iunit, temp_s ; read 200 bytes from disk

reads, temp_s, c2 ; read into a string variable

reads, temp_s, i2 ; read the same data into a short integer variable


... hope this helps
Norbert
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: ** REQUEST ** for a list of well known bugs on SGI with prop' products
Next Topic: Re: Eigensystems in IDL

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

Current Time: Sat Oct 18 20:07:22 PDT 2025

Total time taken to generate the page: 2.15890 seconds