Skip to content

MATLAB

The oceanum-matlab library provides read-only access to the Oceanum Datamesh from MATLAB and GNU Octave.

  • MATLAB R2022b or later
  • GNU Octave 6.0+ (also supported)

The Oceanum toolbox is available form the Mathworks community file exchange. Or download/clone from the Github repository

addpath('/path/to/oceanum-matlab');

Set your Datamesh token as an environment variable:

setenv('DATAMESH_TOKEN', 'your-token-here');
% Initialize connector
connector = oceanum.datamesh.Connector();
% Browse the catalog
catalog = connector.get_catalog();
disp(catalog);
% Search for datasets
results = connector.get_catalog('wave');
% Load a datasource
data = connector.load_datasource('datasource-id');
% Execute a query with filters
query_input = struct(...
'datasource', 'datasource-id', ...
'limit', 1000 ...
);
result = connector.query(query_input);
% Load as NetCDF structure
nc_data = connector.load_datasource('datasource-id', 'format', 'netcdf');
ClassDescription
ConnectorPrimary API communication interface
CatalogDataset discovery and searching
DatasourceIndividual datasource metadata
QueryAdvanced filtering capabilities
StageQuery staging information
SessionAutomatic session handling
  • Catalog browsing - Search and discover datasets
  • Data loading - Load datasources as MATLAB tables or NetCDF structures
  • OceanQL queries - Filter by space, time, and variables
  • Query size limits - Automatic error messaging for large queries
  • Session management - Automatic authentication handling

Compared to the Python library, the MATLAB version:

  • Read-only access (no write operations)
  • Synchronous operations only
  • Limited format support
  • No lazy loading capabilities

The API mirrors the Python library. For detailed guidance, refer to the Python documentation.

GitHub: github.com/oceanum-io/oceanum-matlab