Main Content

captureOutputs

Retrieve outputs from capture run in background using baseband receiver

Since R2024a

Add-On Required: This feature requires the Wireless Testbench™ Support Package for NI™ USRP™ Radios add-on.

Description

[data,timestamp,droppedSamples] = captureOutputs(bbrx) retrieves the outputs of a capture run in the background using the specified baseband receiver. The function returns the path to the file containing the captured data data, capture request timestamp timestamp, and dropped samples status droppedSamples.

example

Examples

collapse all

Create a baseband receiver object, specifying a radio setup configuration previously saved in the Radio Setup wizard.

bbrx = basebandReceiver("MyRadio")
bbrx = 
  basebandReceiver with properties:

               RadioGain: 10
         CenterFrequency: 2.4000e+09
              SampleRate: 153600000
                Antennas: "RF0:RX2"
    DroppedSamplesAction: "error"
         CaptureDataType: "int16"

Capture 1 s of IQ data in the background and save it to a file in the basebandData folder called capture1.mat.

mkdir('basebandData');
capture(bbrx,seconds(1),SaveLocation='basebandData/capture1.mat',Background=true);

Check if the capture is in progress.

isCapturing(bbrx)
ans = logical
   1

Wait for the capture to complete.

while isCapturing(bbrx)
    pause(0.1);
end

Check that the capture is no longer in progress.

isCapturing(bbrx)
ans = logical
   0

Retrieve the outputs of the capture operation and load the captured IQ data into the workspace.

[dataPath,~] = captureOutputs(bbrx);
load(dataPath,'data');

Input Arguments

collapse all

Baseband receiver, specified as a basebandReceiver object.

Output Arguments

collapse all

Path to the MAT-file where the captured data is saved, returned as a character vector. The full path is returned, including the filename and extension.

Note

The first data samples of the captured signal can contain transient values from the radio data path.

Example: 'H:/user/matlab/capture1.mat'

Data Types: char

Capture request timestamp, returned as a datetime value. The function creates this timestamp just before requesting data capture from the hardware.

Data Types: datetime

Status of dropped samples, returned as one of these logical values.

  • 1 — Samples are dropped during capture.

  • 0 — Samples are not dropped during capture.

Use the DroppedSamplesAction property of the bbrx input to specify the behavior of the function upon dropped samples.

Data Types: logical

Limitations

When you call the captureOutputs function, the captured data is moved into the MAT-file specified by the SaveLocation name-value argument of the capture function. This operation can take several seconds and the time depends on the size of the file.

Tips

Check the status of the capture by using the isCapturing function before using the captureOutputs function:

isCapturing(bbrx)
This function returns 1 (true) if a capture is in progress in the background.

Version History

Introduced in R2024a

See Also

Functions

Objects