MATLABRuntimeRun-Time Options
What Run-Time Options Can You Specify?
You can pass the options-nojvm
and日志文件
toMATLAB®Compiler SDK™from a .NET client application using the assembly-level attributesNOJVM
andLOGFILE
. You retrieve values of these attributes by calling methods of theMWMCR
class to accessMATLAB Runtimeattributes and state.
GettingMATLABRuntimeOption Values Using MWMCR
TheMWMCR
class provides several methods to getMATLAB Runtimeoption values. The following table lists methods supported by this class.
MWMCR Method | Purpose |
---|---|
MWMCR.IsMCRInitialized() |
Returnstrue if theMATLAB Runtimerun-time is initialized, otherwise returnsfalse . |
MWMCR.IsMCRJVMEnabled() |
Returnstrue if theMATLAB Runtimerun-time is started with .NET Virtual Machine (JVM™), otherwise returnsfalse . |
MWMCR.GetMCRLogFileName() |
Returns the name of the log file passed with theLOGFILE attribute. |
DefaultMATLABRuntimeOptions
If you pass no options,MATLAB Runtimestarts with default option values:
MATLAB RuntimeRun-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 theMATLAB Runtimeoptions you want to modify.
MWMCR Attribute | Purpose |
---|---|
NOJVM |
Lets users startMATLAB Runtimewith or without a JVM. It takes a Boolean as input. For example,NOJVM(true) startsMATLAB Runtimewithout a JVM. |
LOGFILE |
Lets users pass the name of a log file, taking the file name as input. For example,LOGFILE(" . |
PassingMATLABRuntimeOption Values from a C# Application.Following is an example of howMATLAB Runtimeoption 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); } } } }