Since MATLAB R2013b, the Application Compiler app includes an option to specify a log file name. You may follow the steps below to enable this log file:
- Open your Application Compiler project.
- Expand the "Additional Runtime Settings" section.
- Check the "Create log file" option.
- Enter the desired log file name in the "Log File" field.
- Compile the standalone application.
After following these steps, a log file with the specified name will be created in the current working directory when the standalone application is launched.
When using the "mcc" command to compile the application, use the "-R" and "-logfile" flags:
mcc -m myScript.m -R '-logfile,mylog.txt'
For R2013a and Earlier Releases:
For MATLAB R2013a and earlier, use the "diary" command to generate a log file for a standalone application. Include the following line of code in your program:
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.