There's a C library for that: http://sourceforge.net/projects/matio/
I'm about to test it.