xmcVitisRead is a MATLAB utility that reads data files and outputs them into MATLAB. The function supports real and complex, signed and unsigned numbers. If the file contains timestamps, they will be added to a separate, parallel array.
Syntax
A = xmcVitisRead(fileIn,dataType)
[A, TS] = xmcVitisRead(fileIn,dataType)
Where, the option fileIn
is the file
path and the dataType
represents the datatype of the
imported data.
The following table shows the list of datatypes and maximum possible columns allowed in the input file.
Data Types | Data Size (bits) | Maximum Possible Columns |
---|---|---|
int8 | 8 | 16 |
int16 | 16 | 8 |
int32 | 32 | 4 |
int64 | 64 | 2 |
uint8 | 8 | 16 |
uint16 | 16 | 8 |
uint32 | 32 | 4 |
uint64 | 64 | 2 |
cint16 | 32 | 4 |
cint32 | 64 | 2 |
float | 32 | 4 |
cfloat | 64 | 2 |
Example
Let Input.txt be a file of the following format containing real numbers:
"T 470 ns
1651 -17 6646 -5720
T 472 ns
8850 -2469 2711 7752
T 474 ns
-4938 -6103 -4659 -2352
T 476 ns
-2144 -6453 1410 5685
T 478 ns
-1591 1962 1190 8775"
The following function call imports the array as MATLAB int16
values.
→ A = xmcVitisRead("Input.txt",'int16')
This is the resulting column vector:
A = [
1651,
-17,
6646,
-5720,
8850,
-2469,
2711,
7752,
-4938,
-6103,
-4659,
-2352,
-2144,
-6453,
1410,
5685,
-1591,
1962,
1190,
8775]
The following function call produces two arrays, signal and timestamp. The result is as follows.
→ [A, timestamp] = xmcVitisRead("Input.txt",'int16')
TS = [ A = [
470, 1651,
470, -17,
470, 6646,
470, -5270,
472, 8850,
472, -2469,
472, 2711,
472, 7752,
474, -4938,
474, -6103,
474, -4659,
474, -2352,
476, -2144,
476, -6453,
476, 1410,
476, 5685,
478, -1591,
478, 1963,
478, 1190,
478] 8775]
Important: The function checks for the
number of columns and returns an error if the number of columns exceeds the
theoretical maximum for that data type.
Important: If the file contains
timestamps but they are not required, the
timestamp
output can be left blank. Conversely, if the file does not have timestamps but two
outputs are specified, the timestamp output will be an empty numeric array.