MODE Function
Determines the mode of an array.
Usage
result = MODE(array)
Input Parameters
array—An array of any data type except string.
Returned Value
result—Array of the same data type as array containing the mode of array.
Keywords
None.
Discussion
The mode of an array is the most frequently occurring value in the array.
Example
; Read an image and compute its mode.
image = IMAGE_READ(!IP_Data + 'objects.tif')
image_mode = MODE(image('pixels'))
; Print the mode. This is the value of the largest region.
; Threshold the image for the largest region and display.
PRINT, image_mode
thresh_image = THRESHOLD(image('pixels'), image_mode, /Binary)
TVSCL, thresh_image
See Also