Instrument Control Toolbox | ![]() ![]() |
The Record File Format
The record file is an ASCII file that contains a record of one or more instrument control sessions. You specify the amount of information saved to a record file with the RecordDetail
property.
RecordDetail
can be compact
or verbose
. A compact record file contains the number of values written to the instrument, the number of values read from the instrument, the data type of the values, and event information. A verbose record file contains the preceding information as well as the data transferred to and from the instrument.
Binary data with precision given by uchar
, schar
, (u
)int8
, (u
)int16
, or (u
)int32
is recorded as hexadecimal values. For example, if the integer value 255 is read from the instrument as a 16-bit integer, the hexadecimal value 00FF is saved in the record file. Single- and double-precision floating-point numbers are recorded as decimal values using the %g
format, and as hexadecimal values using the format specified by the IEEE Standard 754-1985 for Binary Floating-Point Arithmetic.
The IEEE floating-point format includes three components -- the sign bit, the exponent field, and the significand field. Single-precision floating-point values consist of 32 bits, and the value is given by
Double-precision floating-point values consist of 64 bits, and the value is given by
The floating-point format component, and the associated single-precision and double-precision bits are given below.
Format Component |
Single-Precision Bits |
Double-Precision Bits |
sign |
1 |
1 |
exp |
2-9 |
2-12 |
significand |
10-32 |
13-64 |
For example, suppose you record the decimal value 4.25 using the single-precision format. The record file stores 4.25 as the hex value 40880000, which is calculated from the IEEE single-precision floating-point format. To reconstruct the original value, convert the hex value to a decimal value using hex2dec
:
Convert the decimal value to a binary value using dec2bin
:
The interpretation of bval
is given by the preceding table. The left most bit indicates the value is positive because (-1)0 = 1. The next 8 bits correspond to the exponent, which is given by
The decimal value of exp
is 27+20 = 129. The remaining bits correspond to the significand, which is given by
The decimal value of significand
is 2-4 = 0.0625. You reconstruct the original value by plugging the decimal values of exp
and significand
into the formula for IEEE singles:
![]() | Specifying a Filename | Example: Recording Information to Disk | ![]() |