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

Home » Public Forums » archive » Re: FIND the indexes of a value in a matrix
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: FIND the indexes of a value in a matrix [message #29982 is a reply to message #29980] Tue, 02 April 2002 08:34 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
chi-kuei (twcollie@hotmail.com) writes:

> I have a 1000 X 4 matrix. I want to know the position of one value, say,
> 2342, in that matrix. I am able to do this in MATLAB with "find". How can I
> do this in IDL? Is there a command in IDL does this? (I don't see any in the
> help file.) The only thing that I can do is creating for-loops.

In IDL, you use the WHERE function:

index = WHERE(matrix EQ 2342, count)
IF count GT 0 THEN print, index, matrix[index]

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Previous Topic: Transparent texture mapped polygons
Next Topic: Re: Findfile finds no files

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

Current Time: Fri Oct 10 20:20:29 PDT 2025

Total time taken to generate the page: 1.11505 seconds