Most of the data streaming and logging methods in Simulink Real-Time use the Simulation Data Inspector (SDI). This includes normal signal logging and the File Log block. Unfortunately, SDI has limited support for deployment. While it is possible to view live streaming data in a MATLAB app while the model is running (e.g. in Axes or other app components), it is not possible to record it to a dataset.
Depending on the MATLAB release you are using to design and compile the app, here are the available options for using File Log data.
File Log & Standalone App support in R2023a and newer
In R2023a and later, the SDI backend database is available for deployment, but SDI visualization is not yet possible.
This means you can use the File Log import function "tg.FileLog.import" in a standalone app to download the log file to the SDI backend database. With this, you can:
- Access the imported data using SDI APIs for custom plots or post-processing.
- Export the imported data into a variable or .mat file using the slrealtime.exportRun API.
- Other APIs such as "tg.FileLog.list" and "tg.FileLog.discard" should also work.
Note that you cannot open the actual SDI interface to inspect the logged data from a standalone app.
In MATLAB R2023b and later you can add a dedicated ImportFileLogButton button to your App Designer app to import a file log from a real-time application run to the host computer. File Log & Standalone App support in R2022b and earlier
In R2022b and earlier, SDI cannot be deployed with MATLAB Compiler at all. This means it is not possible to access the streamed/logged data from a deployed application. Consequently, the regular file log import function "tg.FileLog.import" does not work in deployed standalone applications in R2022b and earlier.
In these releases you can use File Log blocks to log data and disable "AutoImportFileLog" when you start the application. This way, the File Log data will remain on the target PC's storage drive until it is manually downloaded. Since "tg.FileLog.import" does not work in deployed standalone applications in R2022b and earlier, you can try manually copying over the File Log files and then importing them to MATLAB later. However, please note that once the data is copied over, it can only be imported 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:
The provided MATLAB Answers post also offers useful insights on the manual file log import workflow and how to use MATLAB's built-in "ftp" function for this purpose: