MATLAB: How to pass Run-Time Options to the MCR in VB.NET

MATLAB Builder NE

The "Dynamically Specifying Run-Time Options to the MCR" section in the MATLAB Builder NE documentation shows how I can disable the JVM and set a LOGFILE in C#. How can I do the same from a VB.NET application?

Best Answer

In VB.NET attributes are enclosed within angular brackets <>. So the following code could be used to disable the JVM:
<Assembly: MathWorks.MATLAB.NET.Utility.NOJVM(True)>
A full simple Console Application which calls a MATLAB Builder NE Assembly with disabled JVM could thus look like:
<Assembly: MathWorks.MATLAB.NET.Utility.NOJVM(True)>
Module Module1
Sub Main()
Dim obj As myAssembly.myClass
obj = New myAssembly.myClass()
Console.WriteLine("{0}", obj.magicsquare(New MathWorks.MATLAB.NET.Arrays.MWNumericArray(5)))
Console.ReadLine()
End Sub
End Module