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

Home » Public Forums » archive » array
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 [message #90544 is a reply to message #90543] Mon, 09 March 2015 02:50 Go to previous messageGo to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Monday, March 9, 2015 at 10:27:39 AM UTC+1, 8sushil wrote:
> how can i print the location in the matrix knowing the value in that location.

User the where() function as described here:
http://exelisvis.com/docs/WHERE.html

The result is a 1D location. If your matrix/array is 2D and you *need* a 2D result, then you can use array_indices():
http://exelisvis.com/docs/ARRAY_INDICES.html

If the value you're looking for is myValue and the matrix/array is myArray, then you can use this:

position = where(myValue eq myArray, cnt)
print, 'my 1D position is: ', position
print, 'my 2D position is: ', array_indices(myArray, position)

Make sure you check how to use the cnt result (-1 if not found!). This should get you going. If you're looking for floats, it can be a bit more tricky.

Cheers,
Helder
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Subsetting a multiple images using multiple envi vector files (EVFs)
Next Topic: Geopotential height gradient

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

Current Time: Wed Oct 08 15:59:08 PDT 2025

Total time taken to generate the page: 0.00189 seconds