Re: finding array subscripts of minimum value of 3 dim. fltarr [message #12786] |
Thu, 10 September 1998 00:00 |
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
|
|
|
|