Main Content

Selecting .NET Core in MATLAB

Selecting the .NET 6 and higher run-time environment

MATLAB® supports loading .NET assemblies, including:

  • .NET Framework (Microsoft® Windows®)

  • .NET, including .NET Core (Microsoft Windows, macOS, and Linux®)

For details, see System Requirements for Using MATLAB Interface to .NET. For information about .NET versions compatible with MATLAB, see MATLAB Interfaces to Other Languages.

By default, MATLAB loads assemblies using .NET Framework on Microsoft Windows, and using .NET Core on macOS and Linux. To select .NET Core on Microsoft Windows, use the dotnetenv function. The .NET environment information is persistent across different MATLAB sessions.

To select the .NET Core run-time environment, type:

netDate = System.DateTime.Now; % Load .NET
ne = dotnetenv("core")
ne = 

  NETEnvironment with properties:

            Runtime: core
             Status: loaded
            Version: ".NET 6.0.25"
    RuntimeLocation: "C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.25\"

Functions

dotnetenvChange .NET default environment (Since R2022b)

Objects

NETEnvironment.NET environment information (Since R2022b)

Topics