The BYTE function returns a result equal to Expression converted to byte type. If Expression is a string, each string is converted to a byte vector of the same length as the string. Each element of the vector is the character code of the corresponding character in the string. The BYTE function can also be used to extract data from Expression and place it in a byte scalar or array without modification, if more than one parameter is present. See Type Conversion Functions for details.
Result = BYTE( Expression[, Offset [, D1[, ..., D8]]] )
This function returns the result of the Expression converted to byte type.
The expression to be converted to type byte.
The byte offset from the beginning of Expression. Specifying this argument allows fields of data extracted from Expression to be treated as byte data without conversion.
When extracting fields of data, the Di arguments specify the dimensions of the result. If no dimension arguments are given, the result is taken to be scalar.
The Di arguments can be either an array or a series of scalar expressions. If a single argument is specified, it can be either a scalar expression or an array of up to eight elements. If multiple arguments are specified, they must all be scalar expressions. Up to eight dimensions can be specified.
This routine is written to make use of IDL's thread pool, which can increase execution speed on systems with multiple CPUs. The values stored in the
If the variable A contains the floating-point value 10.0, it can be converted to byte type and saved in the variable B by entering:
B = BYTE(A)
Introduced: Original
COMPLEX, DCOMPLEX, DOUBLE, FIX, FLOAT, LONG, LONG64, STRING, UINT, ULONG, ULONG64