Converts an expression tobyte data type.
Extracts data from an expression and places it in a byte scalar or array.
offset
dimi
result
For extracting data:
result
If expr is of type string, each character is converted to its ASCII value and placed into a vector. In other words, each vector element is the ASCII character code of the corresponding character in the string.
If expr is not of type string, then expr is converted to byte data type. The result is expr modulo 256.
TIP: Use BYTSCL to convert expr to byte data type using scaling rather than modulo.
CAUTION: If the values of expr are within the range of a long integer, but outside the range of the byte data type (0 to +255), a misleading result occurs without an accompanying message. For example,BYTE(256)
erroneously results in 0. If the values of expr are outside the range of a long integer data type, an error message may be displayed.
a = BYTE('01abc') INFO, a
A BYTE = Array(5)
PRINT, a
48 49 97 98 99
a = BYTE(1.2) PRINT, a
1
a = BYTE(-1) PRINT, a
255
For more information on using this function to extract data, see the PV-WAVE Programmer's Guide.