Can I import and access File Log data from my Speedgoat target when using a MATLAB Compiler deployed SLRT app?
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 7 Sep. 2023
Bearbeitet: MathWorks Support Team
am 11 Sep. 2025
Can I download and access File Log data from my Speedgoat target using Simulink Real-Time (SLRT) when using a MATLAB Compiler deployed standalone SLRT app?
If I add "tg.FileLog.import" to the app code in R2022b or earlier, the end user of the standalone app gets the following error:
Unable to resolve the name 'Simulink.sdi.Instance.engine'.
When I try to add Simulation Data Inspector (SDI) functions such as "Simulink.sdi.view" or "Simulink.sdi.exportRun" to the standalone app, warnings like the following appear during compilation with MATLAB Compiler, or while running the standalone app:
In "mySLRTapp.mlapp", "Simulink.sdi.view" are excluded from packaging for the MATLAB Runtime environment according to the MATLAB Compiler license. Either remove the file or function from your code, or use the MATLAB function "isdeployed" to ensure the function is not invoked in the deployed component.
Unable to resolve the name 'Simulink.sdi.view'.
Unable to resolve the name 'Simulink.sdi.exportRun'.
Akzeptierte Antwort
MathWorks Support Team
am 10 Sep. 2025
Bearbeitet: MathWorks Support Team
am 11 Sep. 2025
File Log import with Simulink Real-Time relies on the Simulation Data Inspector (SDI) infrastructure. However, SDI currently has limited support for deployment with MATLAB Compiler, which may lead to errors when using Simulink.sdi.* functions. Depending on the MATLAB release used to design and compile the app, the following options are available for importing and accessing file log data from standalone SLRT apps:
Starting with R2023a, the SDI backend database is supported for deployment, enabling import of Simulink Real-Time file log data into standalone apps. Additionally, the slrealtime.exportRun function was introduced to provide data access and export capabilities for SLRT standalone app users.
Although the SDI GUI still cannot be opened from a standalone app to inspect logged data, several programmatic functionalities are available:
1) Import, list, and discard file logs from target using tg.FileLog.import/list/discard:
app.tg = slrealtime;
import(app.tg.FileLog,'ModelName');
2) Access file log data for custom plots or post-processing by exporting runs to a dataset with "slrealtime.exportRun":
runIDs = Simulink.sdi.getAllRunIDs();
lastRunID = runIDs(end);
dataSet = slrealtime.exportRun(lastRunID);
3) Export file log data to a MAT file using the "file" option of "slrealtime.exportRun":
slrealtime.exportRun(lastRunID, "to", "file", "fileName", "fileLog.mat");
From R2023b onward, SLRT standalone app users can also open the Import File Log dialog via the ImportFileLogButton UI component or openImportDialog command. Starting in R2024a, the ImportFileLogButton supports PreImportFcn and PostImportFcn callbacks. With this, you can add "slrealtime.exportRun" calls to the PostImportFcn to automatically export the imported data to a dataset variable or a MAT file.
💡 App Designer support for SLRT has received several new features, and we recommend using at least R2024b if possible. For a summary of the latest updates, see the SLRT Release Notes. You will also benefit from continuous enhancements in MATLAB app performance and responsiveness.
In R2022b and earlier, SDI cannot be deployed with MATLAB Compiler at all. This means it is not possible to access data logged using File Log blocks from a deployed SLRT application. Consequently, the file log import function "tg.FileLog.import" or the File Log Import dialog do not work in deployed standalone applications in R2022b and earlier.
If your goal is to only retrieve the raw file log data from the standalone app, without importing or accessing it, there is an alternative manual file log import workflow that allows bypassing SDI. This workflow is supported for all releases since R2021a.
In this case, you disable "AutoImportFileLog" when you start the application. This way, the File Log data will remain on the target PC's storage drive. Then, you can manually copy over the raw file log data using MATLAB's built-in "sftp" function. See the following MATLAB Answers post for details on the manual file log import workflow:How can I download file log data manually from my Speedgoat target?
However, note that the raw file log data can only be imported and accessed in a MATLAB session, and not within a deployed app. The raw data can only be imported through SDI and not elsewhere. You can refer to the following documentation page for information on importing manually copied file logs:https://www.mathworks.com/help/slrealtime/api/slrealtime.filelogimport.html
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Real-Time Signal Logging and Streaming finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!