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

Home » Public Forums » archive » collapsing 3-d arrays
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: collapsing 3-d arrays [message #6584 is a reply to message #6505] Thu, 11 July 1996 00:00 Go to previous message
hahn is currently offline  hahn
Messages: 108
Registered: November 1993
Senior Member
deb <summa@lanl.gov> wrote:

> I have a pretty large 3-D data array (~10 million pts). I'd like to
> collapse
> the data and look at a 2-d image that contains the max value encountered
> along the third coordinate. I can write a nested loop that
> looks thru the array and pulls out the max data value along the z-axis
> for each
> x,y coordinate pair, but that's pretty cumbersome. It seems like IDL
> should have
> a built-in function for doing this kind of thing, but i can't seem to
> find it.

The IDL function is MAX. It accepts an array as argument and returns
a scalar. Thus you need two nested loops to make a 2-d matrix.

Let's assume your 3-D data array is named D3, you may write:

si = size ( D3 )

D2 = fltarr(si(1),si(2), /nozero)

for i=0,si(1)-1 do begin
for j=0,si(2)-1 do D2(i,j) = max ( D3(i,j,*) )
endfor

Hope this helps
Norbert
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Problem with call_external on SunOS 4.1.3 with acc 3.0.1
Next Topic: IDL & Win95 -- arrggh

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

Current Time: Sat Oct 11 12:54:08 PDT 2025

Total time taken to generate the page: 1.28457 seconds