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

90 views (last 30 days)
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.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 17 Mar 2023
Edited: MathWorks Support Team on 17 Mar 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 Simulink 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

(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 that you should always use "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' folder is not sufficient.
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\
After downloading the data, you can delete single runs or the entire 'logdata' folder from the target computer file system using FTP.
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');
% To inspect the contents:
% cd(ftpobj,'/home/slrt/applications');
% dir(ftpobj)
mget(ftpobj,'/home/slrt/applications/ModelName/');
close(ftpobj)

(3) Import & visualize file log data in MATLAB

At a later point, you can open MATLAB and use the following two functions:
Importing the file logs into MATLAB will require licenses for MATLAB and Simulink Real-Time.
Here is a MATLAB code example to import the local file log data:
% Change current directory to local location of file log data
cd('C:\work\my_logdata\');
% See full list of available file log runs
slrealtime.fileLogList
% Import file logs for model 'MODELNAME'
slrealtime.fileLogImport('MODELNAME');
% Open Simulink Data Inspector
Simulink.sdi.view
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 old MATLAB version.
  2. Export data to a ".mat" file
  3. Load ".mat" file into new MATLAB version.

More Answers (0)

Categories

Find more on MATLAB Runtime in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by