MATLAB Runtime Startup Options
Set MATLAB Runtime Options
For a standalone executable, set MATLAB® Runtime options by specifying the -R
flag and arguments. For
example, specify a log
file.
mcc -e -R '-logfile,bar.txt' -v foo.m
You can set options in the following ways:
The Additional Runtime Settings area of the compiler apps.
The
mcc
command using the-R
flag.
Note
Not all options are available for all compilation targets. For full details, see
mcc
-R
.
Compiler App
In the Additional Runtime Settings area of the
deploytool
compiler apps, you can set the following
options.
MATLAB Runtime Startup Option | Description | Compiler App Setting |
---|---|---|
-R -nojvm | Disable the Java® Virtual Machine (JVM®), which is enabled by default. This can help improve the MATLAB Runtime performance. | Select the No JVM check box. |
-R -nodisplay | On Linux®, open the MATLAB Runtime without display functionality. | In the Settings box, enter -R
-nodisplay . |
-R
'-logfile, | Write information about the MATLAB Runtime startup to a logfile. | Select the Create log file check box. Enter the path to the log file, including the log file name, in the Log File box. |
-R
'-startmsg, | Specify message to be displayed when the MATLAB Runtime begins initialization. | In the Settings box, enter -R
'startmsg, message text' . |
-R
'-completemsg, | Specify message to be displayed when the MATLAB Runtime completes initialization. | In the Settings box, enter -R
'completemsg, message
text' . |
Set Multiple Options Using -R
You can specify multiple -R
options. When you specify multiple
-R
options, they are processed from left to right. For
example, specify initialization start and end
messages.
mcc -R '-startmsg,MATLAB Runtime initialized' -R '-completemsg,Initialization complete'
Retrieve MATLAB Runtime Startup Options
Use these functions to return data about the MATLAB Runtime state when working with shared libraries.
Function and Signature | When to Use | Return Value |
---|---|---|
bool mclIsMCRInitialized() | Use mclIsMCRInitialized() to determine whether or
not the MATLAB Runtime has been properly initialized. | Boolean (true or false ).
Returns true if MATLAB Runtime is already initialized, else returns
false . |
bool mclIsJVMEnabled() | Use mclIsJVMEnabled() to determine if the
MATLAB Runtime is started with an instance of a Java Virtual Machine (JVM). | Boolean (true or false ).
Returns true if MATLAB Runtime has been started with a JVM instance, else returns false . |
const char* mclGetLogFileName() | Use mclGetLogFileName() to retrieve the name of
the log file used by the MATLAB Runtime. | Character string representing log file name used by the MATLAB Runtime, preceded by the character. |
bool mclIsNoDisplaySet() | Use mclIsNoDisplaySet() to determine if
-nodisplay option is enabled. | Boolean (true or false ).
Returns true if -nodisplay is
enabled, else returns false . Note
When running on Mac, if |
Note
All of these attributes have properties of write-once, read-only.
Retrieve Information About MATLAB Runtime Startup Options
The following example demonstrates how to pass options to a C or C++ shared library and how to retrieve the corresponding values after they are set.
const char* options[4]; options[0] = "-logfile"; options[1] = "logfile.txt"; options[2] = "-nojvm"; options[3] = "-nodisplay"; if( !mclInitializeApplication(options,4) ) { fprintf(stderr, "Could not initialize the application.\n"); return -1; } printf("MCR initialized : %d\n", mclIsMCRInitialized()); printf("JVM initialized : %d\n", mclIsJVMEnabled()); printf("Logfile name : %s\n", mclGetLogFileName()); printf("nodisplay set : %d\n", mclIsNoDisplaySet()); fflush(stdout);