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

Home » Public Forums » archive » Re: extract subarray dynamically?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: extract subarray dynamically? [message #31597] Thu, 01 August 2002 07:14
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning (david@dfanning.com) writes:

> temp = arrary[start_x, (start_x + s[0]) < (ss[0]-1]), $
> start_y, (start_y + s[1]) < (ss[1]-1]) ]

Damn. I *always* do that. :-(

Should be, of course:

temp = arrary[start_x:(start_x + s[0]) < (ss[0]-1]), $
start_y:(start_y + s[1]) < (ss[1]-1]) ]

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
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
Re: extract subarray dynamically? [message #31598 is a reply to message #31597] Thu, 01 August 2002 07:12 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
helen (bin_zheng_99@yahoo.com) writes:

> I have a large (e,g, 160, 120) two dimensional integer array and a
> small (e,g, 10, 10)two dimensional integer array. Now I want to do
> some thing like patter match. My problem is how I extract a temporary
> two-dimensional array with the same width and height as the small one
> from the bigger array dynamically?

s = Size(subarray, /Dimensions)
ss = Size(array, /Dimensions)
start_x = 30 ; Or whatever. Assuming positive value inside array.
start_y = 45 ; Or whatever
temp = arrary[start_x, (start_x + s[0]) < (ss[0]-1]), $
start_y, (start_y + s[1]) < (ss[1]-1]) ]

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: extract subarray dynamically?
Next Topic: contour lines on shades surface ?

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

Current Time: Sat Oct 11 09:14:04 PDT 2025

Total time taken to generate the page: 0.56020 seconds