MATLAB Runtime Run-Time Options
What Run-Time Options Can You Specify?
You can pass the options -nojvm
and -logfile
to
MATLAB®
Compiler SDK™ from a .NET client application using the assembly-level attributes
NOJVM
and LOGFILE
. You retrieve values of these
attributes by calling methods of the MWMCR
class to access MATLAB Runtime attributes and state.
Getting MATLAB Runtime Option Values Using MWMCR
The MWMCR
class provides several methods to get MATLAB Runtime option values. The following table lists methods supported by this
class.
MWMCR Method | Purpose |
---|---|
MWMCR.IsMCRInitialized() | Returns true if the MATLAB Runtime run-time is initialized, otherwise returns
false . |
MWMCR.IsMCRJVMEnabled() | Returns true if the MATLAB Runtime run-time is started with .NET Virtual Machine (JVM®), otherwise returns false . |
MWMCR.GetMCRLogFileName() | Returns the name of the log file passed with the LOGFILE
attribute. |
Default MATLAB Runtime Options
If you pass no options, MATLAB Runtime starts with default option values:
MATLAB Runtime Run-Time Option | Default Option Values |
---|---|
.NET Virtual Machine (JVM) | NOJVM(false) |
Log file usage | LOGFILE(null) |
These options are all write-once, read-only properties.
Use the following attributes to represent the MATLAB Runtime options you want to modify.
MWMCR Attribute | Purpose |
---|---|
NOJVM | Lets users start MATLAB Runtime with or without a JVM. It takes a Boolean as input. For example,
NOJVM(true) starts MATLAB Runtime without a JVM. |
LOGFILE | Lets users pass the name of a log file, taking the file name as input.
For example,
LOGFILE(" . |
Passing MATLAB Runtime Option Values from a C# Application. Following is an example of how MATLAB Runtime option values are passed from a client-side C# application:
[assembly: NOJVM(false), LOGFILE("logfile3.txt")] namespace App1 { class Program { static void Main(string[] args) { Console.WriteLine("In side main..."); try { myclass cls = new myclass(); cls.hello(); Console.WriteLine("Done!!"); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } }