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

Home » Public Forums » archive » trouble with pointers within array of structures
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
trouble with pointers within array of structures [message #94442] Tue, 23 May 2017 17:12 Go to previous message
astroboy.20000 is currently offline  astroboy.20000
Messages: 39
Registered: August 2012
Member
I apologize for what I'm sure is a dumb question but I've looked all through the documentation for three days and I apparently am missing something.

I'm trying to store a pointer to a vector as an entry within a structure of arrays. This is the basic idea:


a = { name:'', image : ptr_new(/allocate) }
main = replicate(a,10)

;world() returns a 256x256 floating point image of the world,
;ct() returns a 256x256 floating point CT image


*main[5].image = world()
*main[4].image = ct()

tv, *main[4].image ;gives an image of the CT scan, which is what I expected
tv, *main[5].image ;gives an image of the CT scan
tv, *main[0].image ; ditto
tv, *main[9].image ; ditto

Obviously, I'm missing something fundamental about the syntax here but I've tried every permeation of parentheses and indices I can think of, and no matter what, the last pointer assigned overwrites every other pointer in the structure array.

Can anyone tell me what I should be doing here?

Thanks very much,
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Using color table to map symbol colors in plot
Next Topic: idl parallel processing

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

Current Time: Wed Oct 08 09:18:55 PDT 2025

Total time taken to generate the page: 0.00412 seconds