Main Content
MathWorks.MATLAB.Runtime.OutOfProcessAttribute
.NET attribute class to start a separate process to run a .NET assembly
Since R2022b
Description
The OutOfProcess
attribute lets you start a separate process to run a
.NET assembly.
Assemblies
C:\Program Files\MATLAB\R2024b\extern\dotnet\netstandard2.0\MathWorks.MATLAB.Runtime.dll
C:\Program Files\MATLAB\R2024b\extern\dotnet\netstandard2.0\MathWorks.MATLAB.Types.dll
Class Details
Namespace: | MathWorks.MATLAB.Runtime |
Superclass: | System.Attribute |
Construction
[assembly: OutOfProcess(
launches a separate
process to run a .NET assembly if tf
)]tf
is set to true
.
If tf
is set to false
the .NET assembly runs in the
same process. By default OutOfProcess
is set to
false
.
Parameters
| Boolean |
C# Example
using System; using MathWorks.MATLAB.Runtime; using MathWorks.MATLAB.Types; [assembly: Nojvm(true), OutOfProcess(true)] 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