Read and write MATLAB MAT-files from Java, forked from JMatIO
Clone or download

MatFileRW: Read and write MATLAB MAT-files from Java

Maven artifact Latest version Javadoc License Apache

Changelog Travis CI

MatFileRW is a library which allows reading and writing MAT files. Have a look at to see each part in use.

As far as compatibility, the TL;DR is that it will work with any MAT-File with default settings. The dirty details are that this library works with v6 and v7, but not v4 or v7.3.

  • v4 is the default format before R8
  • v6 is the default format from R8 to R13
  • v7 is the default format from R14 to present (every R20XXX release)
  • MATLAB does not export to v7.3 by default.
  • The Mathworks website has more details.

codemercenary/jmatio and ca.mjdsystems.jmatio

Since JMatIO wasn't updated for a while, lots of people made forks. One of the most prominent was Jason Lokerson's, hosted on GitHub as codemercenary/JMatIO. It included several improvements, but all the packages were renamed to ca.mjdsystems.jmatio. Starting with 2.0.0, all of the improvements from MatFileRW and ca.mjdsystems.jmatio have been merged into the com.jmatio packages.

If you are a user of the ca.mjdsystems packages, you should download com.diffplug.matsim:matfilerw:2.0.0.TRANSITION from mavenCentral. This contains the ca.mjdsystems.jmatio packages unchanged, but marked as deprecated. After you have removed all dependencies on the ca.mjdsystems.jmatio packages, you will be able to use the regular 2.0.0 version, and its descendants.


This project is forked from the JMatIO project originally maintained on SourceForge, and now maintained on GitHub. The name was changed to ensure that we don't infringe the original project's license, but we did not change the package names, so this project is binary compatible with the original JMatIO. We are very thankful to Wojciech Gradkowski for creating JMatIO, but this fork is in no way associated with or endorsed by any authors of the original project.

We have fixed some bugs and added some features (see the changelog), and we will maintain this library into the future. We're happy to accept pull requests too!

People whose commits are included in this project

  • Original JMatIO project credit to Wojciech Gradkowski
  • Thanks to Tim Ryan for finding and fixing a multidimensional indexing bug.
  • MLSparse improvements credit to Sina Samangooei
  • Reading from streams credit to Jonathan Hare
  • MCOS and Simulink MAT-File parsing by Matthew Dawson
  • Further MCOS fixes thanks to Piotr Smolinski
  • int32 writing by Gabriel Shubiner
  • ZLIP EOF Exception fix by David Williams
  • Integration work by Jason Lokerson
  • Multidimensional array indexing by Mikael Grev
  • AbstractIterator taken from Google's Guava

Tools used by this project