Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
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
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