https://github.com/hed-standard/hed-matlab
HED MATLAB supporting tools
https://github.com/hed-standard/hed-matlab
annotation behavior eeg events experiments fmri matlab neuroimaging
Last synced: 27 days ago
JSON representation
HED MATLAB supporting tools
- Host: GitHub
- URL: https://github.com/hed-standard/hed-matlab
- Owner: hed-standard
- License: mit
- Created: 2024-01-19T15:10:17.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-06T12:36:04.000Z (about 1 month ago)
- Last Synced: 2026-01-08T02:51:32.985Z (about 1 month ago)
- Topics: annotation, behavior, eeg, events, experiments, fmri, matlab, neuroimaging
- Language: MATLAB
- Homepage: https://www.hedtags.org/hed-matlab
- Size: 770 KB
- Stars: 1
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://www.hed-matlab.org/en/latest/?badge=latest) [](https://doi.org/10.5281/zenodo.13201056)
# HED-MATLAB
This repository contains the MATLAB supporting code infrastructure for Hierarchical Event Descriptors (HED). HED is an ecosystem that includes standardized vocabularies and tools for annotating what happened during an experiment. HED is used for human behaviorial and neuroimaging experiments. See the [**HED Homepage**](https://www.hedtags.org) for more information.
The documentation for `hed-matlab` can be found at [**MATLAB HEDTools**](https://www.hed-resources.org/en/latest/HedMatlabTools.html).
## Two ways of using HED
The `hed-matlab` MATLAB library provides two approaches for using the HED toolbase: 1) through webservices and 2) through MATLAB calls to the HED Python tools. These approaches provide identical interfaces and are accessed through MATLAB using the same method calls.
### Approach 1: HED web services
In this approach, the HEDTools are accessed through MATLAB wrapper functions that package the function parameters, call the HED web services, retrieve the result, and transform back to suitable MATLAB values.
**Advantages:** No extra installation.
**Disadvantages:** Requires access to Internet.
### Approach 2: HEDTools Python calls
In this approach, the HEDTools are accessed through MATLAB wrapper functions that package function parameters and call the Python `HedTools` directly from MATLAB lab.
**Advantages:** No Internet access needed. Some additional functionality not in the `hed-matlab` interface is provided.
**Disadvantages:** Installation of Python in MATLAB can be tricky and requires MATLAB version >= 2022b.
## Usage
To use HED tools, you first create a HED object by calling `getHedTools`. If you provide the optional host argument, the HED tools use services, otherwise direct calls to Python. Once created, you simply call the available methods using that reference. The process is summarized in the following diagram.

The MATLAB HedTools accept a variety of different types of MATLAB variables as input and convert as appropriate for the underlying calls. On return, the tools convert back to MATLAB types.
## Basic installation
To use the HED tools for MATLAB you need to download the tools either by downloading from GitHub or from MATHWorks File Exchange.
Go to the directory that you want to download the library into. If you are using Git, clone the [**hed-matlab**](https://github.com/hed-standard/hed-matlab) repository.
```shell
git clone https://github.com/hed-standard/hed-matlab.git
```
You can also download the latest release as a zip file from the [**hed-matlab releases**](https://github.com/hed-standard/hed-matlab/releases) tab on GitHub.
Once you have download and unzipped if necessary, you have to add the path of the `hedmat` subdirectory of `hed-matlab` to your workspace:
```matlab
> myPath = 'xxx'; # This should be the full path to hedmat
> addpath(addpath(genpath(myPath));
```
### Additional steps for Python
The Python approach requires you to install Python, install the Python HedTools, and link to MATLAB. See [**Matlab Python Install**](https://www.hed-resources.org/en/latest/HedMatlabTools.html#matlab-python-install) for detailed instructions.
## Funding
Partial support for this project was provided by [**NIH 1R01MH126700-01A1**](https://reporter.nih.gov/project-details/10480619).