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

Home » Public Forums » archive » Re: Changing a structure
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: Changing a structure [message #2383] Fri, 24 June 1994 13:40 Go to next message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
kkobayas@husc9.harvard.edu (Ken Kobayashi) writes:


> In IDL, is there any way to change the structure of an existing structured
> variable? Or do I have to break it down to the components, save, exit, start
> idl again, restore, and re-assemble a new structure?


If you use anonymous structures, then you don't have to go through all that.
Simply create the new structure out of the old structure. For example, suppose
you set

A = {IMAGE: indgen(100,100), LABEL: 'label', DATE: '24-JUN-94'}

and you want to multiply the image 3.74 to put it into physical units. Since
this would convert it from integer to floating point, you can't simply say

A.IMAGE = 3.74*A.IMAGE

However, you can say

A = {IMAGE: 3.74*A.IMAGE, LABEL: A.LABEL, DATE: A.DATE}

It's still a bit tedious, but better than dealing with named structures.

Bill Thompson
Re: Changing a structure [message #2447 is a reply to message #2383] Wed, 29 June 1994 14:47 Go to previous message
HADFIELD[1] is currently offline  HADFIELD[1]
Messages: 9
Registered: March 1994
Junior Member
In article <thompson.772490435@serts.gsfc.nasa.gov> thompson@serts.gsfc.nasa.gov (William Thompson) writes:
> ... suppose
> you set

> A = {IMAGE: indgen(100,100), LABEL: 'label', DATE: '24-JUN-94'}

> and you want to multiply the image 3.74 to put it into physical units. Since
> this would convert it from integer to floating point, you can't simply say

> A.IMAGE = 3.74*A.IMAGE

Well, you can, but the answer is converted to integer type before it's stored
in A.IMAGE.

============================================================ ===========
Mark Hadfield hadfield@greta.niwa.cri.nz
NIWA Marine (Taihoro Nukurangi) NIWA.GRETA:HADFIELD
Wellington, New Zealand
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Map_set & Plots
Next Topic: Resizing already realized widgets

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

Current Time: Fri Nov 28 07:45:10 PST 2025

Total time taken to generate the page: 0.00883 seconds