Skip to content

geospace-code/matlab-stdlib

Repository files navigation

Standard library for Matlab

DOI View stdlib for Matlab on File Exchange ci

Matlab users coming from other languages will benefit from the functionality contained within this user-developed, unofficial "stdlib" standard library of functions. These system, filesystem, and HDF5 / HDF4 / NetCDF functions are used by numerous independent projects.

Self-tests

The self-tests can be run from the top matlab-stdlib/ directory.

Matlab R2022b and newer:

buildtool test

Matlab R2020b and newer:

test_main

External language backends

Our functions that aren't possible in native Matlab code are implemented using Matlab's no-compile external language interfaces. The API listing "backend" column tells which functions have selectable backend implementations. By default, when the "backend" is not specified to a function having selectable backend, the algorithm searches for the first available backend and uses that.

Matlab external backends include:

  • Java: all supported Matlab releases
  • Perl: This uses a system() call to Perl.
  • Python: all supported Matlab releases with CPU-arch matching Python.
  • System shell calls: all supported Matlab releases. As a backup when the platform doesn't have the primary (faster) methods available, the system shell can be called for some functions.
  • .NET as described below.

.NET from Matlab

.NET support in MATLAB when a compatible .NET SDK is installed includes:

  • Windows: all supported Matlab releases, installed from winget search Microsoft.DotNet.SDK
  • Linux or macOS: R2024b and newer

For macOS, brew install dotnet and then in Matlab edit(fullfile(userpath, 'startup.m')) and add the lines

setenv('HOMEBREW_PREFIX', '/opt/homebrew')
setenv('DOTNET_ROOT', [getenv('HOMEBREW_PREFIX') '/opt/dotnet/libexec'])

GNU Octave

Many matlab-stdlib functions work in GNU Octave.

To use matlab-stdlib HDF5 functions in GNU Octave requires the hdf5oct package.

pkg install hdf5oct

Then when wanting to use HDF5 functions, first do:

pkg load hdf5oct

To use matlab-stdlib NetCDF functions in GNU Octave requires the netcdf package.

pkg install netcdf

Then when wanting to use NetCDF functions, first do:

pkg load netcdf

Acknowledgments

Stdlib for Matlab was partly funded by NASA NNH19ZDA001N-HDEE grant 80NSSC20K0176.

About

HDF5, NetCDF4, fileio, system functions that act as an unofficial "stdlib" for Matlab.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors