How can I download file log data manually from my Speedgoat target?

84 visualizzazioni (ultimi 30 giorni)
Is there a way to download file logs manually from my Speedgoat target, either with or without MATLAB?
I am aware that I can import the logs using tg.FileLog.import or Simulink Real-Time Explorer inside MATLAB, but I am looking for a way to transfer, import, and delete the files using basic protocols like FTP or SCP.

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 13 Nov 2023
Modificato: MathWorks Support Team il 13 Nov 2023
Starting in R2021a, there is a supported workflow to copy file log data from the Speedgoat target computer to a host computer without MATLAB. However, note that eventually, you will need to launch MATLAB to import the data in Simulation Data Inspector (SDI) as you cannot view the raw data anywhere else.

(1) How the file log data is stored on the target computer

On the target computer file system, log files generated by File Log blocks are stored under:
Each run is stored in a separate folder under this directory:
Where every run folder contains two files, one .DAT file and one .timestamp file:

(2) Download file log data from target computer

Using a third-party file transfer tool of your choice (e.g. PuTTY pscp, FileZilla), log into the Speedgoat target computer. Please note the default is "slrt" for both username and password when logging into the FTP server on the target computer.
You can either download the entire 'applications' folder, or the 'MODELNAME' subfolder for your specific real-time application:
Note that downloading just the 'logdata' or 'run_x' folders is not sufficient.
After downloading the data, you can delete single runs or the entire 'logdata' folder from the target computer file system using FTP.
PuTTY PSCP example:
Below is an example of how to copy the content of the 'applications' folder from a Speedgoat target computer with IP address at port 22 to the local directory "C:\work\my_logdata\" from the Windows Command Prompt using PuTTY pscp:
"C:\Program Files\PuTTY\pscp.exe" -v -P 22 -pw slrt -r slrt@ C:\work\my_logdata\
MATLAB FTP example:
You can also use the FTP functions shipped with basic MATLAB. Below is a code example:
% Create MATLAB FTP object - use 'ftp' instead of 'sftp' in R2021a and earlier
ftpobj = sftp('','slrt',"Password",'slrt');
% To inspect the available models inside the 'applications' folder:
% dir(ftpobj,'applications')
% To download the file logs for a single model:
% To download the file logs for all models:

(3) Import, visualize & save file log data in MATLAB

To read the file log data, open MATLAB and use the following two functions:
Importing the file logs into MATLAB will require licenses for MATLAB and Simulink Real-Time. There is no way to read the raw .DAT files outside of MATLAB. The only way to import them is going through SDI.
Here is a MATLAB code example to import, view and export the local file log data to a MAT file. It assumes that the 'applications' folder was downloaded from the target into the 'C:\work\my_logdata\' directory on your host computer:
% Change current directory to local location of the 'applications' folder
% See full list of available file log runs
mylist = slrealtime.fileLogList
% Import file logs for model 'MODELNAME'
% Open Simulation Data Inspector to view data (optional)
% Access the most recently created run in SDI
runIDs = Simulink.sdi.getAllRunIDs;
runID = runIDs(end);
% Export from SDI to workspace
simDataset = Simulink.sdi.exportRun(runID);
% Export from SDI to MAT file
Note: Starting in R2022a, the "slrealtime.fileLogImport" function no longer supports importing file logs from log data obtained in different versions of MATLAB. If you have log data from older versions of MATLAB that you would like to import, please use the following workflow:
  1. Load log data into the old MATLAB version.
  2. Export data to a ".mat" file
  3. Load ".mat" file into the new MATLAB version.

Più risposte (0)


Scopri di più su Downloads in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by