.NET support in MATLAB when a compatible .NET SDK is installed includes:
- Windows: all supported Matlab releases
- Linux or macOS: R2024b and newer
brew install dotnetin Matlab
edit(fullfile(userpath, 'startup.m'))add the lines
setenv('HOMEBREW_PREFIX', '/opt/homebrew')
setenv('DOTNET_ROOT', [getenv('HOMEBREW_PREFIX') '/opt/dotnet/libexec'])restart Matlab, then issue the one-time setup command [ dotnetenv
dotnetenv("core", Version="10")where "10" must match the installed .NET SDK major version from
dotnet --list-sdksWindows normally has .NET already available with Matlab, but it may be an old .NET version lacking newer features. A current .NET SDK can be installed using winget
winget search Microsoft.DotNet.SDKTo find the installed .NET SDK file location:
dotnet --list-sdkssince the usual winget list Microsoft.DotNet.SDK --details might not show the installed location.
In Matlab
edit(fullfile(userpath, 'startup.m'))add the location obtained from dotnet --list-sdks to the DOTNET_ROOT environment variable, for example:
setenv('DOTNET_ROOT', 'C:/Program Files/dotnet/sdk')restart Matlab, then issue the one-time setup command
dotnetenv("core", Version="10")where "10" must match the installed .NET SDK major version from
dotnet --list-sdks