Binary File Reader
Reading data from binary files.
blockType: Binary File Reader
Path in the library:
|
Description
Block Binary File Reader reads multi-channel signal data from a binary file. The block reads the header that precedes the data. Parameter File header sets the header structure. You can set the type, size, and complexity of the data using the block parameters.
When reading a file for the first time, the block reads the header, and then the data. On subsequent calls, the block reads the remaining data. When the end of the file is reached, the block returns zeros of the specified data type, size, and complexity. The block can read data both from a file written by the block Binary File Writer, or from any other binary file.
Ports
Output
#
data
—
data from a binary file
scalar
| vector
| matrix
Details
The block reads data from the binary file specified in the parameter File name. The output has dimension Samples per frame on Number of channels. The block can read floating point data and integer data. The input data can be real or complex. If the data is complex, then the block reads them in the form of alternating real and imaginary components. The read block assumes the standard byte order by default set on the host machine.
This port does not have a name until the checkbox is unchecked Output end-of-file indicator.
Data types |
|
Complex numbers support |
Yes |
#
EOF
—
end-of-file indicator
0
| 1
Details
When the block reaches the end of the file, the port outputs `1'. Otherwise, the port outputs `0'.
Dependencies
To use this port, check the box Output end-of-file indicator.
Data types |
|
Complex numbers support |
Yes |
Parameters
Main
# File name — file name
Details
The name of the file from which the block reads data. If the file is not in the current directory, specify the full path to it.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
# File header — file header
Details
If the file does not contain a header, then you should specify empty brackets in the field ()
. If some kind of header is used, then a named tuple must be entered in the field (field1 = value, …, fieldN = valueN
), the values can be strings, numbers, one-dimensional vectors of numbers and two-dimensional matrices of numbers.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
#
Storage data type —
the type of data in the file
Float64
| Float32
| Int8
| Int16
| Int32
| Int64
| UInt8
| UInt16
| UInt32
| UInt64
Details
The type of data stored in the file. This parameter defines the type of output data on the data port.
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Samples per frame —
number of samples in the output signal
Integer
Details
Defines the number of rows of the output matrix. The output matrix has the dimensions Samples per frame on Number of channels. Upon reaching the end of the file, if the output matrix is not filled, the block fills the matrix with zeros, turning it into a full-size matrix.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
#
Data is complex —
data complexity
Logical
Details
If this option is selected, the reading block treats the data from the file as complex. The block reads the data as alternating real and imaginary components and outputs complex values.
For example, if the block is configured to read complex data in the form of a 2
by 2
matrix, then the data [1 5 2 6 3 7 4 8]
will be read as [1 2; 3 4]+1j*[5 6; 7 8]
. If the block is configured to read real data, then the block considers them as [1 5; 2 6]
.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Number of channels —
number of channels in the output signal
Integer
Details
Sets the number of columns of the output matrix. This parameter defines the number of consecutive alternating data samples stored in the file for each time point. The output matrix has the dimensions Samples per frame on Number of channels. Upon reaching the end of the file, if the output matrix is not filled, the block fills the matrix with zeros, turning it into a full-size matrix.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
#
Output end-of-file indicator —
end of file indicator
Logical
Details
If this option is selected, the unit has an additional output port EOF. When the block reaches the end of the file, the port outputs `1'. Otherwise, the port outputs `0'.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
SampleTime (s) —
sampling period
SampleTime (real number / vector of two real numbers)
Details
Controls the sampling period at the output port of the unit. This value represents , where — the sampling frequency of the signal data. The sampling period at the output port is equal to the product of the parameter values Samples per frame and SampleTime (s).
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
#
Indexing mode —
indexing order for reading matrices
Row-major
| Column-major
Details
Choose how the block will read the data.:
-
Row-major
— the data is read taking into account that the matrix was written line by line; -
Column-major
— the data is read taking into account that the matrix was written in columns.
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |