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

Home » Public Forums » archive » Re: subset a 2d 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: subset a 2d array [message #61937 is a reply to message #61932] Wed, 13 August 2008 20:53 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
xiao writes:

> hmmm... The problem is I have a array like 240*500. And all the
> values are different. And I do not know the row and column. I only
> know the center value should be 2.5 . Then ,how can I do that? :)

index = Where(array EQ 2.5, count)
xy = array_indices(array, index[0])
subarray = array[xy[0]-1:xy[0]+1, xy[1]-1:xy[1]+1]

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to preserve trailing Shallow dimensions!
Next Topic: Need help with an Iterative solution in IDL (relative newb question)

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

Current Time: Fri Oct 10 08:19:51 PDT 2025

Total time taken to generate the page: 0.24104 seconds