The BYTSCL function scales all values of Array that lie in the range ( Min <= x <= Max ) into the range (0 <= x <= Top ). The returned result has the same structure as the original parameter and is of byte type.
The maximum value of Array to be considered. If MAX is not provided, Array is searched for its maximum value. All values greater or equal to MAX are set equal to TOP in the result.
The minimum value of Array to be considered. If MIN is not provided, Array is searched for its minimum value. All values less than or equal to MIN are set equal to 0 in the result.
Set this keyword to cause the routine to check for occurrences of the IEEE floating-point value NaN in the input data. Elements with the value NaN are treated as missing data. (See Special Floating-Point Values for more information on IEEE floating-point values.)
BYTSCL is often used to scale images into the appropriate range for 8-bit displays. As an example, enter the following commands:
IM = DIST(200) ; Create a simple image array.
TV, IM ; Display the array as an image.
Now scale the image into the full range of bytes (0 to 255) and re-display it by entering:
IM = BYTSCL(IM) ; Byte scale the image and store the result in the same variable.