Here are the primary methods for working with EyeLink Data Files (EDF) in MATLAB:
- Convert Files to ASCII
You can convert your EDF files to ASCII (.asc) format using either VisualEDF2ASC or the command-line converter edf2asc.- VisualEDF2ASC is bundled with Data Viewer (but does not require a USB license) and is also available as a stand-alone download.
- After conversion, you can read the resulting ASCII files into MATLAB using standard text import functions.
- VisualEDF2ASC is bundled with Data Viewer (but does not require a USB license) and is also available as a stand-alone download.
- Import the files directly using EDFMEX
A more direct method is to use EDFMEX, a tool created by community member Christopher Kovach in 2007. EDFMEX is a wrapper for the C-based EDF Access API, compiled as a MATLAB MEX function that allows you to load EDF files directly.- Prerequisites
- Important: You must have the EyeLink Developers Kit installed on your system to provide the necessary EDF Access API libraries. You can download the latest kit here.
- Download
Using Pre-Compiled EDFMEX SR Research recommends first trying the pre-compiled version of EDFMEX. Builds are available for:- Windows (x86 and x64 platforms)
- macOS ( intel, m1/m2)
- Linux (Debian x86 and x64 platforms - tested on ubuntu)
preCompiled_edfmex.zip (Size: 61.73 KB / Downloads: 371)
- Windows (x86 and x64 platforms)
- Installation
Once downloaded, unzip the contents into a folder that is on your MATLAB path (e.g., Documents/MATLAB).
These builds were compiled with MATLAB R2009SP1 and should be compatible with all subsequent MATLAB versions.
- Usage
Use the following syntax in MATLAB to import your file:
Code:edfStruct = edfmex('myFile.edf');
- Data Structure
The attached file provides detailed information on the structure of data within EDF files:
EDF_Data_Structure.pdf (Size: 35.68 KB / Downloads: 1,321)
Additional Resources- EDF Access API Documentation: For details on the imported data structures, please see the documentation included with the EyeLink Developers Kit.
- Compiling from Source: If the pre-compiled versions do not work, see the EDF importer for Matlab for instructions on compiling edfmex yourself.
- An Introduction to EyeLink Data (EDF Files): This guide outlines the contents of the EDF file and how to understand the contents of the EDF files.
- Prerequisites

