BYTSCL

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.

Calling Sequence

Result = BYTSCL( Array )

Arguments

Array

The array to be scaled and converted to bytes.

Keywords

MAX

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.

MIN

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.

NAN

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.)

TOP

The maximum value of the scaled result. If TOP is not specified, 255 is used. Note that the minimum value of the scaled result is always 0.

Example

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.

TV, IM ; Display the new image.

See Also

BYTE , TVSCL