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:
/home/slrt/applications/MODELNAME/logdata
Each run is stored in a separate folder under this directory:
/home/slrt/applications/MODELNAME/logdata/run_1
/home/slrt/applications/MODELNAME/logdata/run_2
Where every run folder contains two files, one .DAT file and one .timestamp file:
/home/slrt/applications/MODELNAME/logdata/run_1/tid001.dat
/home/slrt/applications/MODELNAME/logdata/run_1/2023-06-13_16-10-53.timestamp
(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:
/home/slrt/applications/
/home/slrt/applications/MODELNAME/
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 192.168.7.5 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@192.168.7.5:applications C:\work\my_logdata\
MATLAB FTP example:
You can also use the FTP functions shipped with basic MATLAB. Below is a code example:
ftpobj = sftp('192.168.7.5','slrt',"Password",'slrt');
cd(ftpobj,'/home/slrt');
mget(ftpobj,'./applications/MODELNAME/');
mget(ftpobj,'./applications/');
close(ftpobj)
(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:
cd('C:\work\my_logdata\applications');
mylist = slrealtime.fileLogList
slrealtime.fileLogImport('MODELNAME');
Simulink.sdi.view
runIDs = Simulink.sdi.getAllRunIDs;
runID = runIDs(end);
simDataset = Simulink.sdi.exportRun(runID);
Simulink.sdi.exportRun(runID,'to','file','filename','filelog.mat');
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:
- Load log data into the old MATLAB version.
- Export data to a ".mat" file
- Load ".mat" file into the new MATLAB version.