Main Content

read

Read radar data cubes from the binary files using dca1000FileReader object

Since R2024b

Description

data = fr.read() returns a cell array with one element that corresponds to one radar data cube that is read using dca1000FileReader object, fr. The CurrentPosition property of fr also gets incremented by 1 after a radar data cube is read. data will be empty if no new data cube is available to read from the CurrentPosition.

[data,numDataCubesRead] = fr.read(numDataCubesToRead) returns a cell array with number of elements equal to numDataCubesToRead that correspond to radar data cubes that are read using dca1000FileReader object, fr. The CurrentPosition property of fr also gets incremented by a value equal to numDataCubesToRead, and the subsequent read function call considers this number as the index to start reading the data. If the specified number of data cubes are not available to read from the CurrentPosition, then the function returns the available data cubes as cell array and actual number of data cubes read as second output argument numCubesRead.

[data,numDataCubesRead] = fr.read(numDataCubesToRead, indexToRead) considers a specific index to start reading data and returns a cell array with number of elements equal to numDataCubesToRead that corresponds to radar data cubes that are read from dca1000FileReader object, fr. The CurrentPosition property of fr is set based on indexToRead and it gets incremented by a value equal to numDataCubesToRead after the read operation. This new index becomes the CurrentPosition when you call read function the next time.

Examples

Start Reading Radar Data Cubes Using dca1000FileReader Object

Create a dca1000FileReader object by specifying the file location where the recorded files are stored.

fr = dca1000FileReader(RecordLocation = "C:\Users\DCA_data")
fr =
 
  dca1000FileReader with properties:
 
                 BoardName: "IWR6843ISK"
                ConfigFile: "C:\Users\DCA_data\Range10Hz.cfg"
            RecordLocation: "C:\Users\DCA_data\"
          RecordFilePrefix: "iq_data"
              NumDataCubes: 63

Use the read function of the object to read radar two data cubes from the recordings, one-by-one.

% Read first data cube available. Now fr.CurrentPosition = 1, after the read,
% fr.CurrentPosition will be updated to 2 
data = fr.read()
data =

  1×1 cell array

    {240×4×32 double} 
% Read next data cube available. Now fr.CurrentPosition = 2, after the read,
% fr.CurrentPosition will be updated to 3 
data = fr.read();
data =

  1×1 cell array

    {240×4×32 double}

Read 4 radar data cubes from the recordings, by specifying numDataCubesToRead. Note that the CurrentPosition got updated to 3 after the last read operation in the previous code.

% Read 4 data cubes (index 3 to 6) . fr.CurrentPosition = 3
numDataCubesToRead = 4;
data = fr.read(numDataCubesToRead);
data =

  1×4 cell array

    {240×4×32 double}    {240×4×32 double}    {240×4×32 double}    {240×4×32 double}

Read radar data cubes from a known index 11, by overriding the CurrentPosition.

numDataCubesToRead = 4;
indexToRead = 11
% Read 4 data samples starting from Index 11 (specified by indexToRead). 
% Here the fr.CurrentPosition is internally reset to 11.
[data, numRadarCubesRead] = fr.read(numDataCubesToRead, indexToRead)
% After this read operation, fr.CurrentPosition = 15

Read all IQ data cubes one-by-one from the binary files recorded using the class dca1000

Create a dca1000FileReader object by specifying the file location where the recorded files are stored.

fr = dca1000FileReader(RecordLocation = "C:\Users\abc\dca1000data")
fr =
 
  dca1000FileReader with properties:
 
                 BoardName: "IWR6843ISK"
                ConfigFile: "C:\Users\abc\dca1000data\Range10Hz.cfg"
            RecordLocation: "C:\Users\abc\dca1000data\"
          RecordFilePrefix: "iq_data"
              NumDataCubes: 63

Read all radar data cubes one-by-one in a loop until no more data cubes are available for reading.

while hasData(fr)
        iqData = read(fr);
     end

Read all IQ data cubes in single call to read()

Create a dca1000FileReader object by specifying the file location where the recorded files are stored.

fr = dca1000FileReader(RecordLocation = "C:\Users\abc\dca1000data")
fr =
 
  dca1000FileReader with properties:
 
                 BoardName: "IWR6843ISK"
                ConfigFile: "C:\Users\abc\dca1000data\Range10Hz.cfg"
            RecordLocation: "C:\Users\abc\dca1000data\"
          RecordFilePrefix: "iq_data"
              NumDataCubes: 63

Use NumDataCubes property of dca1000FileReader to read all data cubes.

iqDataCubes = fr.read(fr.NumDataCubes);

Record IQ data for a duration of 10s and read all IQ data recorded

Create a dca1000 object to create connection to TI IWR6843ISK board and DCA1000EVM capture card.

dcaObj = dca1000("IWR6843ISK",RecordDuration = 10)

Start Recording for 10 seconds, wait till recording is completed.

dcaObj.startRecording();
       while (isRecording(iqDataSource))
       end

Create a dca1000FileReader object by specifying the file location where the recorded files are stored.

dr = dca1000FileReader(RecordLocation = dcaObj.RecordLocation)

Use NumDataCubes property of dca1000FileReader to read all data cubes at once.

iqDataCubes = dr.read(dr.NumDataCubes);

Input Arguments

collapse all

dca1000FileReader object with the default or specified properties.

Number of radar data cubes to be read , specified as a numeric scalar.

Data Types: double

Index (in terms of radar data cubes) from which a new read operation must start, specified as a numeric scalar.

Data Types: double

Output Arguments

collapse all

Cell array of radar data cubes read from dca100FileReader object. The number of elements in cell array depends on numDataCubesToRead that you specified, or the number of data cubes available to read from the current position of read pointer. If there is not enough numDataCubesToRead, the data will be a cell array of radar data cubes that are available. If there is no new data to read from CurrentPosition, then data will empty cell array.

Data Types: array

Number of radar data cubes that are read using read function. If you assign the input value numDataCubesToRead to a number that is more than what is available to read, the read function returns data only as much as available, and the number of radar cubes read is returned using the argument numDataAvailableinstead of numCubesRead.

Data Types: double

Version History

Introduced in R2024b