Main Content

MathWorks.MATLAB.Runtime.RuntimeOptionAttribute

R2026b

.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\R2026b\extern\dotnet\netstandard2.0\MathWorks.MATLAB.Runtime.dll

C:\Program Files\MATLAB\R2026b\extern\dotnet\netstandard2.0\MathWorks.MATLAB.Types.dll

Class Details

Namespace:

MathWorks.MATLAB.Runtime
Superclass:System.Attribute

Construction

[assembly: RuntimeOption("option")] passes "option" to the application at initialization time.

Parameters

option

Description

-nodisplay

Suppress the MATLAB nodisplay run-time warning. On Linux®, open MATLAB Runtime without display functionality.

-singleCompThread

Limit MATLAB to a single computational thread.

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