File Exchange

image thumbnail

JMatIO - Matlab's MAT-file I/O in JAVA

version 1.0 (203 KB) by

Package contains Matlab's MAT-file I/O API in JAVA. Supports Matlab 5 MAT-flie format reading and wr

11 Ratings



View License

JMatIO is a JAVA library to read/write/manipulate with Matlab's binary MAT-files.

Currently supported data types are:
+ Double array
+ UInt8, Int8 array
+ UInt64, Int64 array
+ Char array
+ Structure
+ Cell array
+ Sparase array

this project is also available at

Comments and Ratings (14)

Can support for UInt32 be added?

Ned Twigg

Great library, but it hasn't been updated in a while. I am maintaining a binary-compatible fork with some bugfixes and new features here:
- added support for 16-bit integers
- robust parsing of Java objects embedded in the MAT-File
- fixed some bugs in equals() and hashCode() implementations
- OSGI metadata
- available on Maven Central as com.diffplug.matsim:matfilerw


Irma (view profile)

very useful! Thanks


Jayant (view profile)

How can we save a 3 dimensional array of type MLUInt8? I have the image stored in MWNumericArray format. I am able to create the array of 3 dimensions but I am not able to figure out how to copy the data inside it.

Essam Soliman

how to use this library?

Stuart Bowman

Thank you! This is a big help in the world of java apps that produce data that engineers need to analyze. Great API.


rohit (view profile)

very useful

Bryant Mairs

Would be useful to support the single data type. Odd omission from this library.


Lei (view profile)

Execellent. But problem with large mat files. I have these error messages when reading a large mat file ( > 40 M):
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at Source)
at Source)
at Source)
at Source)
at<init>(Unknown Source)
at<init>(Unknown Source)
at com.Tester.common.Tester.main(

Is there a fix?

iskandar mamaik

Olav -

Very useful library

Leon Lee

Very useful!


+ bugfix: struct/cell reading fails when containing empty arrays
+ added: int64 and uint64 support

+ REGRESSION BUG: double arrays created natively in Matlab are not read correctly (reversed byte ordering)

+ Added support:UInt8 array
+ MAJOR reading performance enhancement - reading is as fast as in Matlab now
+ Removed Log4j references

+improved performance of MatFileReader (~100% faster now)
+JUnit tests added to test and show usage of Cells and Strucutures

+bug fix: poor performance with big arrays
+documentation updated
+jmatio.jar added

+ bug fix: reading unsigned values
+ new constructor in MLDouble supporting double[][]
+ filtered reading of MAT-file
+ JUnit test updated

Following users' suggestions (thank you Imran) some code parts were modified:
+MLDouble array supports Jama style constructors, and JAVA types
+MLChar String exports
+MatFileReader maps content by name
+JUnit tests added
+JavaDoc added

MATLAB Release
MATLAB 7.0.4 (R14SP2)

Inspired: CSMatIO: MAT-file I/O API for .NET 2.0

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

» Watch video

Win prizes and improve your MATLAB skills

Play today