image thumbnail

matlab-stdlib

version 4.1.5 (29.7 KB) by Michael Hirsch
HDF5 / NetCDF4, file IO, system functions that should be included in Matlab

64 Downloads

Updated 02 Dec 2021

From GitHub

View license on GitHub

Matlab standard library

View matlab-hdf5 on File Exchange

Matlab users coming from other languages often notice the missing functionality contained within this user-developed, unofficial "stdlib" for Matlab. These system "sys", file I/O "fileio" and HDF5/NetCDF "hdf5nc" function are useful across several of our own and others projects.

Usage

This package is a Matlab package, so we assume you have done like:

import stdlib.hdf5nc.*
import stdlib.fileio.*
import stdlib.sys.*

or use the full package name like stdlib.fileio.expanduser()

Selftests can be run from that matlab-stdlib/ directory:

runtests('stdlib.tests')

HDF5

import stdlib.hdf5nc.*

Check HDF5 version built into Matlab:

[major,minor,rel] = H5.get_libversion()

Check that a dataset exists in file:

h5exists(filename, dataset_name)

Save a variable to a dataset. If dataset exists, the existing dataset shape must match the variable.

h5save(filename, dataset_name, dataset)

Get the dataset size (shape)

h5size(filename, dataset_name)

Get the names of all datasets in a file

h5variables(filename)

NetCDF4

import stdlib.hdf5nc.*

Check NetCDF4 version built into Matlab:

netcdf.inqLibVers

Check that a variable exists in file:

ncexists(filename, variable_name)

Save a variable to a dataset. If dataset exists, the existing dataset shape must match the variable.

ncsave(filename, variable_name, variable)

Get the dataset size (shape)

ncsize(filename, variable_name)

Get the names of all datasets in a file

ncvariables(filename)

Cite As

Michael Hirsch (2020). matlab-stdlib (https://github.com/geospace-code/matlab-stdlib/releases/tag/v4.0.1), GitHub. Retrieved July 28, 2020.

Hirsch, Michael. Geospace-Code/Matlab-hdf5: Zenodo Doi. Zenodo, 2020, doi:10.5281/ZENODO.3964541.

View more styles
MATLAB Release Compatibility
Created with R2021a
Compatible with R2020b and later releases
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.