主要内容

Import File Log Data from Speedgoat Target Computer

This example shows a variety of approaches for importing Parquet format File Log data from a Speedgoat target computer to a development computer.

The file log import approaches that require MATLAB and Simulink Real-Time include:

The file log import approaches that just use MATLAB and third-party tools include:

  • sftp or third-party tools to transfer log files to the development computer

  • parquetread or third-party tools read Parquet log files

After you transfer the file logs to the development computer, you can import the logs into the Simulation Data Inspector for data visualization, view the data in MATLAB by using the parquetread function, or use third-party tools to view the PARQUET file data.

In R2026a and later releases, the slrealtime.fileLogImport function is a legacy workflow that may be removed in future releases. Use the other file log import approaches.

File Log Data Storage on Target Computer

In the file system on the target computer, Simulink Real-Time stores log files that are generated from signal data in folders for each real-time application.

By default, file logs are automatically imported by MATLAB and only one file log run is retained on the target computer. You can change these settings by changing the default settings for the AutoImportFileLog and FileLogMaxRuns options of the start(tg) function.

Import File Log Data from Target Computer by Using Simulink Real-Time

For data visualization in the Simulation Data Inspector, use these Simulink Real-Time functions for File Log import.

  • Importing by using the start function with AutoImportFileLog option is the most common approach to importing file log data because the AutoImportFileLog option is enabled by default for the start(tg) function.

  • Importing by using the import function is often used for importing file log data from after re-connecting a standalone target computer to a development computer.

  • Importing by using the importToFolder function or by using the openImportDialog function are approaches that let you import the file log data files for viewing in third-party tools.

Import File Log Data from Target Computer by Using Third-Party Tools

By using a third-party file transfer tool (for example, PuTTY or FileZilla), log into the target computer. The default username and password are slrt for login to the FTP server on the target computer.

If you are using the slrealtime.fileLogImport function to import the the PARQUET log files into the Simulation Data Inspector, import the entire applications folder or import the real-time application slrt_ex_osc subfolder, for example:

/home/slrt/applications/
/home/slrt/applications/slrt_ex_osc/

If you are using MATLAB or a third-party tool to view the PARQUET files, you do not need to import entire folders. You can import and view just the PARQUET files (and related JSON files) of interest from the logdata/run_x folders.

After importing the data, you can delete single runs or the entire logdata folder from the target computer file system by using SFTP.

This example shows how use PuTTY PSCP to copy the content of the applications folder from a target computer with IP address 192.168.7.5 at port 22 to the local directory C:\work\my_logdata\ from the Windows command prompt by using the PuTTY pscp utility:

"C:\Program Files\PuTTY\pscp.exe" -v -P 22 -pw slrt -r slrt@192.168.7.5:applications C:\work\my_logdata\

Import, Visualize, and Save File Log Data in MATLAB

To read the file log data, open MATLAB and use these functions:

These steps use MATLAB and Simulink Real-Time to import log files and view the data by using the Simulation Data Inspector.

This code example shows how to import, view, and export the local file log data to a MAT file. This code assumes that the applications folder was imported from the target computer into the development computer C:\work\my_logdata\ folder.

1. Change current directory to local location of the applications folder.

cd('C:\work\my_logdata\applications');

2. View a full list of available file log runs.

mylist = slrealtime.fileLogList

3. Import file logs for real-time application slrt_ex_osc.

import(tg.FileLog,'slrt_ex_osc');

Note that the legacy workflow that uses the slrealtime.fileLogImport() function is no longer recommended.

4. Open the Simulation Data Inspector to view data (optional).

Simulink.sdi.view

5. Access the most recently created run in the Simulation Data Inspector.

runIDs = Simulink.sdi.getAllRunIDs;
runID = runIDs(end);

6. Export from the Simulation Data Inspector to workspace.

simDataset = Simulink.sdi.exportRun(runID);

7. Export from the Simulation Data Inspector to MAT file.

Simulink.sdi.exportRun(runID,'to','file','filename','filelog.mat');

In R2022a and later releases, the slrealtime.fileLogImport function does not support importing file logs from log data obtained in different versions of MATLAB. If you have log data from older versions of MATLAB to import, use these steps:

  • Load log data into the MATLAB release in which it was created.

  • Export data to a MAT file.

  • Load the MAT file into the current MATLAB release.

See Also

| | |