Documentation

SimulinkRealTime.utils.getFileScopeData

Read real-time Scope file format data

Syntax

matlab_data = SimulinkRealTime.utils.getFileScopeData(slrtfile_name)
matlab_data = SimulinkRealTime.utils.getFileScopeData(slrtfile_data)

Description

example

matlab_data = SimulinkRealTime.utils.getFileScopeData(slrtfile_name) takes as an argument the name of a development computer file containing a vector of byte data (uint8). Before using this function, copy the file from the target computer using the SimulinkRealTime.copyFileToHost method.

example

matlab_data = SimulinkRealTime.utils.getFileScopeData(slrtfile_data) takes as an argument a MATLAB® variable containing a vector of byte data (uint8). Before using this function, load the data into memory from a file on the target file system using the SimulinkRealTime.fileSystem.fread method.

Examples

collapse all

Upload file 'data.dat' to the host. Read the file on the host. Plot the results.

Upload file 'data.dat' from the target computer to the development computer.

SimulinkRealTime.copyFileToHost('data.dat')

Read the file and process its data into MATLAB format.

matlab_data = SimulinkRealTime.utils.getFileScopeData('data.dat');

Plot the signal data (column 1) on the Y axis against time (column 2) on the X axis.

plot(matlab_data.data(:,2), matlab_data.data(:,1))
xlabel(matlab_data.signalNames(2))
ylabel(matlab_data.signalNames(1))

Read file 'data.dat' on the target computer from the host. Store the data in a MATLAB workspace variable. Convert the data to MATLAB format. Plot the results.

Read file 'data.dat' from the development computer using file system commands.

fs = SimulinkRealTime.fileSystem;
h = fopen(fs, 'data.dat');
slrtfile_data = fread(fs, h);
fclose(fs,h)

Process data from the workspace variable into MATLAB format.

matlab_data = 
     SimulinkRealTime.utils.getFileScopeData(slrtfile_data);

Plot the signal data (column 1) on the Y axis against time (column 2) on the X axis.

plot(matlab_data.data(:,2), matlab_data.data(:,1))
xlabel(matlab_data.signalNames(2))
ylabel(matlab_data.signalNames(1))

Input Arguments

collapse all

File must contain a vector of uint8 data.

Data Types: char

Data Types: uint8

Output Arguments

collapse all

The state and time data is stored in a structure containing six fields. The key fields are numSignals, data, and signalNames.

Internal

Internal

Internal

If N signals are connected to the real-time Scope block, numSignals = N + 1.

The data array contains numSignals columns. The first N columns represent signal state data. The last column contains the time at which the state data is captured.

The data array contains as many rows as there are data points.

The signalNames vector contains numSignals elements. The first N elements are signal names. The last element is the character vector Time.

Introduced in R2014a

Was this topic helpful?