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

Home » Public Forums » archive » array referencing problem ...
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 referencing problem ... [message #43045 is a reply to message #42954] Tue, 08 March 2005 16:02 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Andreas Brunn writes:

> I have a problem referencing a three dimensional array with a two
> dimensional mask. One solution I�m well aware of is building a two
> dimensional array and copy this in each channel of the three dimensional.
> But there must be a more elegant and memory saving method doing this, so i
> tried the following and ran in an in my eyes a little bit strange behaviour:
>
> ENVI> a=findgen(5,5,5)
> ENVI> ma=where(a le 10)
> ENVI> print, (a(*,*,1))(ma)
> 25.0000 26.0000 27.0000 28.0000 29.0000 30.0000 31.0000 32.0000 33.0000
> 34.0000 35.0000
> thats what I hoped and expected as a result
>
> but if I try the following:
> ENVI> (a(*,*,1))(ma) = 2
> % Expression must be named variable in this context: <FLOAT Array[5, 5]>.
> % Execution halted at: $MAIN$
>
> I only get that error message, where is my mistake ?

Too many parentheses. :-)

Here is an article that might help:

http://www.dfanning.com/code_tips/tempvar.html


> Is there a way applying this mask on each of the channels without copying
> each channel in a two dimensional array ?

I would have a look at the Dimensional Juggling Tutorial:

http://www.dfanning.com/tips/rebin_magic.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: calling c from idl
Next Topic: Extract an image

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

Current Time: Wed Oct 08 20:06:18 PDT 2025

Total time taken to generate the page: 0.41911 seconds