メインコンテンツ

MathWorks.MATLAB.Runtime.RuntimeOptionAttribute

初期化時にアプリケーションに渡される MATLAB Runtime のオプションを指定するための .NET 属性クラス

R2022b 以降

説明

RuntimeOption 属性を使用すると、初期化時にアプリケーションに渡される MATLAB® Runtime のオプションを指定できます。

アセンブリ

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

クラスの詳細

名前空間:

MathWorks.MATLAB.Runtime
スーパークラス:System.Attribute

構築

[assembly: RuntimeOption("option")] は、初期化時にアプリケーションに "option" を渡します。

パラメーター

option

説明

-nodisplay

MATLAB nodisplay の実行時警告を抑制します。Linux® で、MATLAB Runtime を表示機能なしで開きます。

-singleCompThread

MATLAB を単一の計算スレッドに制限します。

-softwareopenglレンダリングに Mesa Software の OpenGL® を使用します。

C# の例

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();
        }
    }
}

バージョン履歴

R2022b で導入