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:
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.
Best Answer