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

Home » Public Forums » archive » Re: finding array subscripts of minimum value of 3 dim. fltarr
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: finding array subscripts of minimum value of 3 dim. fltarr [message #12786] Thu, 10 September 1998 00:00
Jonas is currently offline  Jonas
Messages: 23
Registered: May 1998
Junior Member
Jens Redemann skrev i meddelandet <35F6EF28.699D@cisk.atmos.ucla.edu>...
> Hi everybody,
>
> can anybody key me in on the most efficient way of finding
> the subscripts of the minimum value of a three-dimensional float
> array?
> What is the exact numbering convention behind the single-subscript
> that the min(array) function returns?
> Hope this is not too trivial of a question.
>
> Thanks in advance,
>
> Jens

Hi jens
Here's a few rows of code to find out the position of the minimum absolute
value of a complex 3D array called compl_kspace_vol. Hope it helps (and that
it is correct). Note that you have to use data types that can handle numbers
as large as "minpos" everywhere (almost) in order to get the mods and
divisions right.
Sincerely
Jonas


print, 'finding min'
mincompl=min(abs(compl_kspace_vol), minpos)
print, 'minimum value of 3D matrix:', mincompl
print, minpos
XYpos=minpos mod (long(xsize)*long(ysize))
Zpos = minpos/(long(xsize)*long(ysize))
Xpos = xypos mod xsize
Ypos = xypos/xsize
print, 'Position of minimum value:'
print, 'xpos=', xpos
print, 'ypos=', ypos
print, 'slice=', zpos
Re: finding array subscripts of minimum value of 3 dim. fltarr [message #12798 is a reply to message #12786] Wed, 09 September 1998 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Jens Redemann (redemann@cisk.atmos.ucla.edu) writes:

> can anybody key me in on the most efficient way of finding
> the subscripts of the minimum value of a three-dimensional float
> array?
> What is the exact numbering convention behind the single-subscript
> that the min(array) function returns?
> Hope this is not too trivial of a question.

You can find out how to convert WHERE function output to
2D and 3D array subscripts in this article on my web page:

http://www.dfanning.com/tips/where_to_2d.html

Cheers,

David

----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: [Q] extracting value from a structure ...
Next Topic: Current Idl spec results: for Alpha-NT4

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

Current Time: Wed Oct 08 19:33:14 PDT 2025

Total time taken to generate the page: 0.00459 seconds