Home | News | Documentation | Download

Mroot - MATLAB/ROOT data interface



I’ve written a MATLAB/ROOT data interface for reading and writing ROOT files from within MATLAB just as you do with MATLAB files. This enables research projects which use MATLAB for computation to store and exchange their data in the powerful ROOT file format.

The following MATLAB data types are supported:

  • Cell
  • Structure
  • Logical
  • Char
  • Single/Double
  • (U)Int-8/16/32/64

The following file types are implemented:

  • TFile
  • TXMLFile
  • TNetFile
  • TSQLFile

Unfortunately only TFile works on all tested Platforms (SUSE, Ubuntu, WinXP). The other file types actually work only on SUSE 10.2. Maybe you’ll run in even more trouble when testing. I’m still learning that C++ and memory management stuff…

The interface is based on MEX, so you have to compile the C++ files in src/ first. The compile.m file may help. After this you can call rsave and rload in MATLAB as you would do with save and load.

Further documentation can be found in my diploma thesis (main.pdf, in German).

I’ll be thankful, if you republish improvements on my software, when you make some.

Kind regards, Johannes Kissel.

P.S.: I’ll post the link to my file in the MATLAB file exchange as soon as Mathworks released it.

mathworks.com/support/tech-n … /1605.html

ROOT & Matlab usable together?

Mathworks dropped my file, because I didn’t want to switch to a BSD License. That’s why I attached it here now.

[color=red]And to say it clear: With this tool you’re NOT able to load each and any ROOT-file, but only ROOT-files which were created with mroot or which are compatible.[/color]

For further explanations see also my diploma thesis (it’s german). Section 2.1 (especially the pages 28/29) is the important part :wink:
mroot.zip (61.8 KB)


Thanks Johannes for this interesting post. I will mention it in the release notes.



Really… thanks! I’ve found an other tool to import data from ROOT to Mathematica:



Hi joki,

I really want to try this out, but I’m having trouble compiling the src files in the src directory using compile.m. Namely it looks like the file mpatrol.h is nowhere to be found. I’m compiling using the command compile(‘mroot.cpp’) in MATLAB R2010a.


Hi, note that the original post is 9 years old so I wouldn’t be surprised if the code didn’t work correctly


Yes, I did note this. I was hoping that there was a more updated version of
this tool or something like it.