Reads a BINARY data file and returns a series.
READB("filename", filetype, numpts, offset, byteswap)
"filename" |
- |
A string, the name of the input file. If no path is given, READB searches the current working directory for the file. |
filetype |
- |
An integer, the binary format type of the data file described by either its name or integer code. Valid arguments are: |
Name |
Code |
Data Type |
Range |
INT8 SBYTE |
1 |
8-bit Signed Byte |
-128 to +127 |
UINT8 UBYTE BYTE |
2 |
8-bit Unsigned Byte |
0 to 255 |
INT16 SINT |
3 |
16-bit (2-byte) Signed Integer |
-32768 to +32767 |
UINT16 UINT |
4 |
16-bit (2-byte) Unsigned Integer |
0 to 65535 |
INT32 LONG |
5 |
32-bit (4-byte) Signed Integer |
-2,147,483,648 to +2,147,483,647 |
FLOAT |
6 |
32-bit (4-byte) Floating Point |
-1037 to +1038 |
DOUBLE |
7 |
64-bit (8-byte) Floating Point |
-10-307 to +10308 |
UINT32 ULONG |
8 |
32-bit (4-byte) Unsigned Integer |
0 to 4,294,967,295 |
INT64 |
9 |
64-bit (8-byte) Signed Integer |
-9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 |
UINT64 |
10 |
64-bit (8-byte) Unsigned Integer |
0 to 18,446,744,073,709,551,615 |
|
1000 + N |
N-byte Signed Integer |
-28N-1 to 28N-1-1 |
|
2000 + N |
N-byte Unsigned Integer |
0 to 28N-1 |
numpts |
- |
Optional. An integer. The number of points to read. Defaults to all points (-1). |
||||
offset |
- |
Optional. An integer. The number of bytes to skip. Defaults to 0. |
||||
byteswap |
- |
Optional. An integer. Swap the order of the bytes read.
|
A series.
writeb("test.bin", SINT, {1, 2, 3, 4})
W1: readb("test.bin", SINT)
returns the series {1, 2, 3, 4}.
writeb("test.bin", INT16, {1, 2, 3, 4})
W1: readb("test.bin", INT16)
returns the series {1, 2, 3, 4}.
readb("myfile", FLOAT, 1024, 18)
reads 1024 floating point numbers starting at the 19th byte in the file.
a = readb("myfile", FLOAT, -1, 18)
reads all floating point numbers in the file starting at the 19th byte and assigns the series to variable a.
sine3 = int(100 * gsin(100, 1/100, 2));
writeb("sine3.dat", 1003, sine3);
W1: readb("sine3.dat", 1003)
W1 contains 100 samples of a sinewave saved as 3 byte signed integers. The special filetype value of 1000 + N specifies an N byte signed integer value.
READB ignores any header information in the data file. To retain header info, use the Import Utilities.
READB also supports N byte integer format to read signed or unsigned multiple bytes as integer values. A filetype value of 1000 + N specifies N byte signed integer values and 2000 + N specifies N byte unsigned integer values. For example:
1003
implies a 3 byte signed integer values.
2005
implies a 5 byte unsigned integer values.
Use WRITEA to write a series as ASCII or WRITEB to write a series as binary.