How can I create an output log for my compiled standalone application?
57 views (last 30 days)
Show older comments
MathWorks Support Team
on 4 Nov 2009
Commented: dpb
on 2 May 2022
I am using MATLAB Compiler to build a standalone application. I would like the standalone application to create a log file that contains the text that is displayed in the Command Window when I run the application within MATLAB. I want to do this so that I can debug my application when it generates errors. Is it possible to have a standalone application create this kind of log file?
Accepted Answer
MathWorks Support Team
on 18 Dec 2020
Edited: MathWorks Support Team
on 14 Jan 2021
For R2013b and Above
In MATLAB R2013b and above, an option has been added to the standalone application compiler that can be used to specify the name of a log file. This log file will contain the same information that is displayed in the Command Window when the application executes within MATLAB. You may follow the steps below to enable this log file:
1. Open the MATLAB Compiler project for your standalone application.
2. In the main window, expand the "Additional Runtime Settings" section.
3. Within this section, enable the "Create log file" check box.
4. In the "Log File" text field, enter the name to use for the log file.
5. Compile the standalone application.
After following the above steps, a log file with the name you specified in step 4 will be created in the current working directory when the standalone application is launched.
For R2013a and Earlier Releases
For MATLAB R2013a and earlier, the "diary" command can be used to generate a log file for a standalone application. To use the "diary" command to generate log files, include the following line of code in your program:
diary on
When the diary is enabled, the application will create a log file that includes all of the commands executed by the standalone application and all of the text that is displayed in the Command Window. Please note that any commands executed before the diary is enabled will not be logged.
When the above code is compiled into the standalone application, the application logs will be written to a file named "diary" located in the current working directory.
1 Comment
More Answers (0)
See Also
Categories
Find more on Java Package Integration 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!