File Exchange

image thumbnail


version 1.4 (7.42 KB) by

abfload imports data in the Axon abf format (three different recording modes).



View License

abfload imports data in the Axon abf format. Data may have been acquired in the following modes:

(1) event-driven variable-length
(2) event-driven fixed-length
(3) gap-free

The major output variable d may be a 2D array, a 3D array or a cell array, depending on the recording mode. Information about scaling, the time base (that is, the sampling frequency), and the number of channels and episodes is extracted from the header of the abf file. For details, see help text of abfload.
** PLEASE NOTE: abfload can only deal with abf versions <2 (files acquired with pclamp versions <10). Use abf2load (see below) for all abf versions including the new ones.

Comments and Ratings (15)

hello,thank you for this it was very useful. I have a problem with the time plotting,when i plot extracted data the time in x axis does not look like the one in the clampfit file,can you help me ?

Eran Zohar


bar (view profile)

hello, thank you very useful. I want replace the old file we use by the newest version, but option 'info' look like remove. You talk about abfinfo.m in the header but I cannot found this file. Can you help me?

Very useful utility, I use it a lot.
There seems to be a problem sometimes with clampfit generated files. The solution is to include the following after 'the hack' (~line 275):
if isempty(goodstart)
goodstart = strfind(lower(char(BigString)'),'clampfit');

Also, in the functions 'define_xxxxxxx' the use of % in names is problematic because this leads to truncated statements in the function ReadSection. Easiest solution is to take all '%' out.

With these small changes I can load all files I want.


Rami (view profile)

Great utility! thank you :)



D H (view profile)

I partially ported this code to python, see


Great function.
It would be really useful to use 'single' (or even 'int16') variable type for loading in data. This should be more then sufficient for the 12bit encoding in abf files and would save a substantial amount of space. doubles are 64bit and I routinely run out of memory in matlab when using abfload larger files.
Suggestions are welcome.

Yoav Mor

I have found that it is not the nDataFormat that needs to be changed to "Short", rather it is the "nADCNumChannels". Changing this to Short fixes a range of problems with reading abf files, up to version 1.83 (that's what I tested).

Carlos E

On a related note, the latest versions of pCLAMP/Axoscope 10.x can export ABF2 files as ABF 1.8 files

Carlos E

The ABF variable nDataFormat is of type 'short' for version 1.8 of the ABF header. abfload uses an int and so it reads more than it should when trying to open ABF 1.8 files. Usually it just fails. Therefore if you want to open and ABF 1.8 file just change the line 'nDataFormat',100,'int',-1; to use short instead of int then it should work.

Harald Hentschke

Please note: abfload will not work with data acquired with versions 10.x (and up) of pClamp/Axoscope because of major changes in the header structure. There is no way these changes can be accomodated as details of the header structure (which are essential for direct header access into abf files) will no longer be made publicly available.

Joanna Huttunen

Excellent for older types of .abf files. For files collected with Axoscope 10, it does not work... =(

Jim Chambers

works great...I am using it to generate IV curves in real time. Very nice.



- minor bug fix (in exceedingly rare cases an error resulted reading gap-free data, namely when division of the number of points by 'chunkPtsPerChan' left no remainder)
- the help (H1) now informs on the limitation of the code to abf versions < 2.0


BSD license added, all else is the same.

the update of 2005-08-12 got lost or never made it to the file exchange - here it is again with minor additional improvements

- bug fix (number format for two header parameters was incorrect, leading to errors during upload in rare cases)
- option to specify number format (essential on platforms other than win)
- improved upload of gap-free data (less memory consumption)

1. Silly but fatal bug in the section for import in 'event-driven variable-length mode' (sorry)
2. Stricter input checking: an error will result if ANY of the requested channels does not exist in data file

MATLAB Release
MATLAB 6.5.1 (R13SP1)

Inspired: fcollman/abfload

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video