Why file log is corrupted when I disconnect from the target while the real time simulation is running (Unable to import requested runs: Index in position 1...)?
2 views (last 30 days)
Show older comments
Hi,
I am using a speedgoat as realtime target.
Why the log data file is corrupted when I disconnect from the target while the real time simulation is running?
The error that I got when I try to import the run is the one described below. Notice that when I let the simualtion reach the stop time, the log data file is imported WITHOUT ANY ERROR.
--
Error: Unable to import requested runs: Index in position 1 is invalid. Array indices must be positive integers or logical values.
--
I tried to remove all that could activate data signal streaming and interaction with the SDI before disconnecting in order to only use a File Log for data logging. I also disable all signal logging in SDI.
Here is the behaviour that I observed:
________________________
The imported file IS NOT CORRUPTED when I do the following commands:
connect(tg);
load(tg, 'Application_speedgoat');
start(tg,'AutoImportFileLog',false,'ExportToBaseWorkspace',false); % Start the application
startRecording(tg);
.. Let the simulation finish
Import the log file from slrtExplorer
________________________
BUT, The imported file IS CORRUPTED when I do the following commands:
connect(tg);
load(tg, 'Application_speedgoat');
start(tg,'AutoImportFileLog',false,'ExportToBaseWorkspace',false); % Start the application
startRecording(tg);
... before the end of the simulation
%---
removeAllInstruments(app.tg);
stopRecording(app.tg);
pause(3);
disconnect(app.tg); % Discconnect from speedgoat
%---
________________________
Here is below the file log Simulink block used. I use "Enable File Log" in order to be able to use startReconrding and stopRecording to manage live signal streaming before disconnection.
Best regards,

0 Comments
Answers (1)
Kautuk Raj
on 7 May 2025
I was also facing the same issue in MATLAB R2024b while using Simulink Real-Time.
I followed the following steps as a workaround:
First, you will need to use any file transfer utility to connect to the target and copy over the directory containing the application. Then you can use the following command to extract the data:
slrealtime.fileLogImport("app_debug")
Simulink.sdi.view
With this procedure you will be able to view the data collected from the application after disconnecting from a target while the application is running.
Please see the example titled "Copy File Logs from Target Computer and Import Folder" from the documentation page above for more information on this procedure.
0 Comments
See Also
Categories
Find more on Target Computer Setup in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!