Re: extract subarray dynamically? [message #31597] |
Thu, 01 August 2002 07:14 |
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  |
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
|
|
|