Main Content

DataRecorder

Data recording session for specified SoC hardware board

Description

ADataRecorderobject can configure and log data from input sources on an SoC hardware board connected to MATLAB®. You can save the recorded data to a file for future use to playback in MATLAB and Simulink®models.

Creation

Description

example

dr= soc.recorder(hw)creates a data recording session,dr, on the SoC hardware board connection represented byhw.hwis ansocHardwareBoardobject.

Input Arguments

expand all

Hardware object, specified as asocHardwareBoardobject that represents the connection to the SoC hardware board.

Properties

expand all

Name of supported SoC hardware board, specified as a character vector.

Data Types:char

List of hardware-peripheral input sources added to data recording session, specified a character vector. To add input sources to asoc.recorderobject, call theaddSourceobject function.

Data Types:cell

This property is read-only.

Status of data recording session, specified as a logic value offalse(0) ortrue(1). To get the status of the data recording session, call theisRecordingobject function.

Data Types:logical

Object Functions

addSource Add a input source to a data recording session
removeSource Remove input source from data recording session
setup Set up hardware for data recording
record Record data from hardware using data recorder object
isRecording Get data recording status
save Save recorded data from SoC hardware board to file on host PC

Examples

collapse all

Create a connection from MATLAB to the specified SoC hardware board using the IP address, username, and password of the board.

hw = socHardwareBoard('Xilinx Zynq ZC706 evaluation kit','hostname','192.168.1.18','username','root','password','root');

Create a data recording session on the SoC hardware board by using thehwobject. The resultingDataRecorderobject represents the data recording session on the SoC hardware board.

dr = soc.recorder(hw)
dr = DataRecorder with properties: HardwareName: 'Xilinx Zynq ZC706 evaluation kit' Sources: {} Recording: false

List the input sources added to the data recording session.

dr.Sources(hw)
ans = 1×0 empty cell array

By default,soc.recorderobjects have no added input sources. To add an input source to the data recording session, first create an input source object by using thesoc.iosourcefunction. For this example, create an User Datagram Protocol (UDP) source object.

udpSrc = soc.iosource(hw,'UDP Receive')
udpSrc = soc.iosource.UDPRead with properties: Main LocalPort: 25000 DataLength: 1 DataType: 'uint8' ReceiveBufferSize: -1 BlockingTime: 0 OutputVarSizeSignal: false SampleTime: 0.1000 HideEventLines: true Show all properties

将这个UDP源对象添加到数据记录ession by using theaddSourceobject function.

addSource(dr,udpSrc,'UDPDataReceived-Port25000')

Verify the result by inspecting theSourcesproperty of thesoc.recorderobject.

dr.Sources
ans = 1×1 cell array {'UDPDataOnPort25000'}

Call the setup function to initialize all hardware peripheral input sources added to the data recording session, and start the data recording process.

setup(dr)

Record data for 60 seconds on the SoC hardware board.

record(dr, 60);

Check the status of the data recording session by using theisRecordingobject function. The recording status when data recording is in progress is1.

recordingStatus = isRecording(dr)
recordingStatus =逻辑1

The recording status when data recording is complete is0.

isRecording(dr)
recordingStatus =罗技cal 0

Save recorded data to a TGZ-compressed file.

save(dr,'UDPDataReceived','UDP Data Testing',{'Recorded On Zynq Board'})

This function saves the recorded data as the fileUDPDataReceived.tgzin your working folder of the host PC. You can read this file by using ansocFileReaderobject in MATLAB or anIO Data Sourceblock in your Simulink model.

Remove the added source from the data recording session by using theremoveSourceobject function.

removeSource(dr,'UDPDataReceived-Port25000')

Verify the result by inspecting theSourcesproperty of thesoc.recorderobject.

ans = 1×0 empty cell array

Version History

Introduced in R2019a