MathWorks.MATLAB.Runtime.RuntimeOptionAttribute
.NET attribute class for specifying MATLAB Runtime options that are passed to the application at initialization time
Since R2022b
Description
The RuntimeOption attribute lets you specify MATLAB® Runtime options that are passed to the application at initialization time.
Assemblies
C:\Program Files\MATLAB\R2025b\extern\dotnet\netstandard2.0\MathWorks.MATLAB.Runtime.dll
C:\Program Files\MATLAB\R2025b\extern\dotnet\netstandard2.0\MathWorks.MATLAB.Types.dll
Class Details
Namespace: | MathWorks.MATLAB.Runtime |
| Superclass: | System.Attribute |
Construction
[assembly: RuntimeOption( passes
"option")]"option" to the application at initialization time.
Parameters
| Description |
|---|---|
-nodisplay | Suppress the MATLAB
|
-singleCompThread | Limit MATLAB to a single computational thread. |
-softwareopengl | Use Mesa Software OpenGL® for rendering. |
C# Example
using System;
using MathWorks.MATLAB.Runtime;
using MathWorks.MATLAB.Types;
[assembly: RuntimeOption("-singleCompThread")]
namespace MyConsoleApp
{
class Program
{
static void Main(string[] args)
{
try
{
string ctfPath = @"P:\MATLAB\work\mylinspace.ctf ";
using (dynamic matlab = MATLABRuntime.StartMATLAB(ctfPath))
{
double[] vec = matlab.mylinspace(1.0, 100.0);
foreach (double i in vec)
{
Console.Write("{0} ", i);
}
}
}
catch (MathWorks.MATLAB.Exceptions.MATLABNotAvailableException)
{
Console.Error.WriteLine("Could not start MATLAB Runtime.");
}
MATLABRuntime.TerminateApplication();
}
}
}
Version History
Introduced in R2022b