Re: subset a 2d array [message #61939] |
Wed, 13 August 2008 20:19 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
xiao writes:
> For example, i hava an array like this:
>
> 13, 14, 15, 16, 17
> 23, 24, 25,26, 27
> 2, 4 , 5, 66 ,7
> 13, 14, 15, 16, 17
> 13, 14, 15, 16, 17
>
> i know the center value is 5 .Then i want to subset the array to 3*3
> and 5 is still the center. Just subset like this :
>
> 24, 25,26
> 4 , 5, 66
> 14, 15, 16,
>
> Any one has good ideas how can i do that?
How about something like this:
subarray = array[1:3, 1:3]
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.")
|
|
|