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

Home » Public Forums » archive » array indexing question
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: Array indexing [message #31548 is a reply to message #31442] Tue, 16 July 2002 01:50 Go to previous message
marc schellens[1] is currently offline  marc schellens[1]
Messages: 183
Registered: January 2000
Senior Member
Andre Kyme wrote:
> Hi everyone,
>
> I have a 2D image and want to index a bunch of (x,y) pairs.
> X is the set of x coords and Y the set of y coords. Say I want
> to set all (x,y) pairs to 200:
>
> image[X,Y]=200
>
> This is fine. But if image has multiple slices and I do:
>
> image[X,Y,0]=200
>
> all possible combinations of points in X and Y get set to 200,
> whereas I only want corresponding values in X and Y set.
> Is there some array notation I'm missing that enables this?

All possible combinations you get when the indexing arrays are of
different size.
So here you want to write:

Z=lonarr(n_elements(X))
image[X,Y,Z]=200

cheers,
:-) marc
[Message index]
 
Read Message
Read Message
Previous Topic: Array indexing
Next Topic: widget layout

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

Current Time: Thu Oct 09 20:42:11 PDT 2025

Total time taken to generate the page: 1.75965 seconds