Dynamically Specifying Run-Time Options to the MCR
What Run-Time Options Can You Specify?
As of R2009a, you can pass MCR run-time options -nojvm and -logfile to MATLAB Builder NE from
a client application using the assembly-level attributes NOJVM and LOGFILE.
you can retrieve values of these attributes by calling methods of
the MWMCR class to access MCR attributes and MCR
state.
Back to Top
Getting MCR Option Values Using MWMCR
The MWMCR class provides several methods
to get MCR option values. The following table lists methods supported
by this class.
| MWMCR Method | Purpose |
| MWMCR.IsMCRInitialized() | Returns true if MCR is initialized, otherwise
returns false. |
| MWMCR.IsMCRJVMEnabled() | Returns true if MCR is launched with Java
Virtual Machine (JVM), otherwise returns false. |
| MWMCR.GetMCRLogFileName() | Returns the name of the log file passed with the LOGFILE attribute.
|
Default MCR Options
If you pass no MCR options (you provide no attributes), the
MCR is launched with default option values:
| MCR Run-Time Option | Default Option Values |
| Java 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 MCR options you
want to modify.
| MWMCR Attribute | Purpose |
| NOJVM | Lets users launch MCR with or without a JVM. It takes a Boolean
as input. For example, NOJVM(true) launches MCR
without a JVM. |
| LOGFILE | Lets users pass the name of a log file, taking the file name
as input. For example, LOGFILE("logfile3.txt") . |
Example: Passing MCR Option Values from a C# Application.
Following is an example of how MCR 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);
}
}
}
}
Back to Top
 | Improving Data Access Using the MCR User Data Interface and MATLAB Builder NE | | Accessing Real or Imaginary Components Within Complex Arrays |  |
Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
Get the Interactive Kit