Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB Builder NE   

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.

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 MethodPurpose
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 OptionDefault Option Values
Java Virtual Machine (JVM)NOJVM(false)
Log file usageLOGFILE(null)

These options are all write-once, read-only properties.

Use the following attributes to represent the MCR options you want to modify.

MWMCR AttributePurpose
NOJVMLets users launch MCR with or without a JVM. It takes a Boolean as input. For example, NOJVM(true) launches MCR without a JVM.
LOGFILELets 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);
                }
            }
        }
    }
  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS