The COCOHA Matlab Toolbox is a coding framework internally shared within the COCOHA project. It was written to standardize MATLAB data storage and decoding analysis for the project. The data structure (GitLab login required) is based loosely on FieldTrip’s, but allows for the storage of multiple data sources (e.g. audio/EEG) and provides flexibility in defining dimensions (e.g. channel, time, frequency, rate, scale, etc). Moreover, function calls that modify the contents of the data structure will append their user-defined parameters to the data.cfg cell array. This allows for traceability of results.
The functions in the toolbox allow for external functions to operate on the data structure in a robust and standardized way.
The MATLAB components are designed for offline prototyping of decoding strategies. On the other hand, realtime processing is primarily implemented with OpenViBE Python scripts. OpenViBE is used as it provides drift correction, and its support for object-oriented programming allows better modularity.
The toolbox is not designed to replace FieldTrip for more traditional M/EEG analyses, but rather as a means to supplement such analyses with a support for decoding models. As such FieldTrip import capability is provided (and export capability is still pending).
- MATLAB signal processing toolbox
- MATLAB parallel processing toolbox (optional – for GPU support)
- FieldTrip (optional – for data import)
- OpenViBE, Python2, NumPy, SciPy, PyAudio (optional – for realtime framework)
Tutorials (To Come…)
- Importing data
- Speech envelope decoding
Accessing the Toolbox
A publically avaialble archived distribution of the toolbox is available on Zenodo. For COCOHA project members, the internal version of the toolbox can be accessed on GitLab. If you don’t have access, contact Daniel Wong with your username once you have created a GitLab account. Once you have been added to the project, you will be able to access the toolbox contents as described below.
The wiki contains tutorials on how to use the toolbox (GitLab login required).
The toolbox can be downloaded as a zip file (GitLab login required). Alternatively for those who are actively developing the toolbox, or would rather update their local copy incrementally, Git access is available. Before a Git client can be used, you need to generate an SSH key pair and add the public key to your GitLab account (GitLab login required). Generating the SSH keys can be done with
ssh-keygen on Mac/Linux or PuTTYgen on Windows. The private SSH key can then be added to the system’s authentication agent via
ssh-add on Mac/Linux or Pageant on Windows. The repository can then be cloned from
firstname.lastname@example.org:cocoha/cocoha-matlab-toolbox.git. If using Git on the command line, the following guide should help get you started.
Git Command Line Introduction
COCOHA project members can access the Git repository for the latest code and to make edits. More information on the following commands can be obtained from the Git Reference.
git config --global user.name "FirstName LastName"
git config --global user.email "email@example.com"
Cloning the repository:
git clone firstname.lastname@example.org:cocoha/cocoha-matlab-toolbox.git
Synchronizing with the repository:
fetch will download data from the repository that you don’t have locally. Running
merge will then merge anything new on the repository into the current branch.
git fetch origin
git merge origin/master
To make edits to the code (provided you have permissions), a new branch needs to be created within which you can make changes, before requesting that the changes be merged with the master branch.
To list existing branches (both local and remote):
git branch -a
To make a new branch and switch to it:
git checkout -b branchName
To switch to an already existing branch:
git checkout branchName
Committing and pushing specific files:
To avoid accidentally overwriting changes made by someone else, it is recommended to synchronize with the repository and retest potential conflicting changes before committing.
git add FileName(s)
git commit -m "Message describing change"
git push origin branchName
Committing and pushing all modified files:
As stated previously, it is recommended to synchronize with the repository before committing.
git commit -am "Message describing change"
git push origin branchName
When you are ready to merge your edits with the master branch, you can create a merge request.