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

Home » Public Forums » archive » Re: changing a datatype in a structure
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: changing a datatype in a structure [message #48642] Thu, 11 May 2006 13:18 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
Kenneth Bowman wrote:
> You cannot change the type of a variable inside a structure, but you can add a
> new variable to an existing (anonymous) structure.
>
> IDL> data = {i : LINDGEN(5)}
> IDL> help, data, /str
> ** Structure <215d270>, 1 tags, length=20, data length=20, refs=1:
> I LONG Array[5]
> IDL> data = CREATE_STRUCT(data, 'x', FLOAT(data.i))
> IDL> help, data, /str
> ** Structure <215d330>, 2 tags, length=40, data length=40, refs=1:
> I LONG Array[5]
> X FLOAT Array[5]
> IDL> print, data
> { 0 1 2 3 4
> 0.00000 1.00000 2.00000 3.00000 4.00000
> }

Yes, but what you've actually done is destroy the old one and create a
new one, as the different ID numbers above attest. The difference
doesn't generally matter for structures with small amounts of data but
it certainly can for large ones.

--
Mark Hadfield "Kei puwaha te tai nei, Hoea tahi tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: 6.3 reactions?
Next Topic: VIRUS: [avast! - INFECTED] HOT TEEN WEB CAM SHOTS FROM MSN MESSENGER

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

Current Time: Wed Oct 08 18:11:53 PDT 2025

Total time taken to generate the page: 0.00453 seconds