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 
Return to the default flat view Create a new topic Submit Reply
Re: Changing a structure [message #2383] Fri, 24 June 1994 13:40 Go to previous 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
[Message index]
 
Read Message
Read Message
Previous Topic: Map_set & Plots
Next Topic: Resizing already realized widgets

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

Current Time: Fri Oct 10 11:01:35 PDT 2025

Total time taken to generate the page: 1.03841 seconds