Windows, Linux, macOS
The Matlab Interface plugin is not included by default in the Open Ephys GUI. To install, use ctrl-P or ⌘P to open the Plugin Installer, browse to the “Matlab Interface” plugin, and click the “Install” button.
The Plugin Installer also allows you to upgrade to the latest version of this plugin, if it’s already installed.
Before starting data acquisition, you will need to press the “Connect” button in the editor to initiate a connection between the plugin and your Matlab session. The plugin will open a socket using the IP and Port address listed in the Matlab Interface editor.
To initialize the connection on the Matlab side, you will need to call your generated script from Matlab following the instructions below. Once the connection has been initiated on both sides, pressing the “Play” button in the Open Ephys GUI will automatically stream the incoming data to Matlab, and then back to the GUI for further processing.
In order to process the incoming data in Matlab, you will need to leverage the included Matlab API.
The Matlab API is centered around a GenericProcessor class that encapsulates an Open Ephys data processor. The idea is to write your own class that inherits and extends GenericProcessor. A starting template is included below:
classdef MyClass < GenericProcessor
%define any variables you want to keep track of here (see examples)
function self = MyClass(host, port)
self = self@GenericProcessor(host, port);
%Initialize any variables here (see examples)
methods (Access = protected)
numSamples = self.dataIn.numSamplesFetched;
data = self.dataIn.continuous(1:end);
%Do whatever you want with the data here (see examples)
Additional examples can be found in the plugin’s README file.
The following screenshot shows data being transmitted from the Open Ephys GUI and plotted in real time in Matlab: