# Mroot - MATLAB/ROOT data interface

**URL:** <https://root-forum.cern.ch/t/mroot-matlab-root-data-interface/7212>\
**Category:** Evolution Proposals, Apps & Ideas\
**Created:** [September 30, 2008, 12:53pm UTC](https://root-forum.cern.ch/t/mroot-matlab-root-data-interface/7212 "2008-09-30T12:53:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![joki](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/5f9b8f/32.png) [@joki](https://root-forum.cern.ch/u/joki)\
**Post date:** [September 30, 2008, 12:53pm UTC](https://root-forum.cern.ch/t/mroot-matlab-root-data-interface/7212/1 "2008-09-30T12:53:45Z")

</div>

Hi!

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](http://www.mathworks.com/support/tech-notes/1600/1605.html)  
[root.cern.ch/](http://root.cern.ch/)  
[fuzzy.fzk.de/~USCT/](http://fuzzy.fzk.de/~USCT/)

---

<div class="post-metadata">

**Author:** ![joki](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/5f9b8f/32.png) [@joki](https://root-forum.cern.ch/u/joki)\
**Post date:** [October 1, 2008, 2:32pm UTC](https://root-forum.cern.ch/t/mroot-matlab-root-data-interface/7212/2 "2008-10-01T14:32:21Z")

</div>

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](http://www.ipe.fzk.de/~ruiter/DPA/Kissel.pdf) (it’s german). Section 2.1 (especially the pages 28/29) is the important part 😉  
[mroot.zip](https://root-forum.cern.ch/uploads/default/original/2X/b/b303130bd5aacb1044a407c70bfded3d5f91e2a1.zip) (61.8 KB)

---

<div class="post-metadata">

**Author:** ![brun](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/b9e5f3/32.png) [@brun](https://root-forum.cern.ch/u/brun)\
**Post date:** [October 2, 2008, 9:18am UTC](https://root-forum.cern.ch/t/mroot-matlab-root-data-interface/7212/3 "2008-10-02T09:18:06Z")

</div>

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

Rene

---

<div class="post-metadata">

**Author:** ![wiso](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wiso/32/11120_2.png) [@wiso](https://root-forum.cern.ch/u/wiso)\
**Post date:** [March 20, 2009, 12:22am UTC](https://root-forum.cern.ch/t/mroot-matlab-root-data-interface/7212/4 "2009-03-20T00:22:41Z")

</div>

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

[mathroot.sourceforge.net/](http://mathroot.sourceforge.net/)

---

<div class="post-metadata">

**Author:** ![ybagdasa](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/f1d935/32.png) [@ybagdasa](https://root-forum.cern.ch/u/ybagdasa)\
**Post date:** [October 27, 2017, 10:22pm UTC](https://root-forum.cern.ch/t/mroot-matlab-root-data-interface/7212/5 "2017-10-27T22:22:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [October 27, 2017, 11:07pm UTC](https://root-forum.cern.ch/t/mroot-matlab-root-data-interface/7212/6 "2017-10-27T23:07:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ybagdasa](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/f1d935/32.png) [@ybagdasa](https://root-forum.cern.ch/u/ybagdasa)\
**Post date:** [October 30, 2017, 4:16am UTC](https://root-forum.cern.ch/t/mroot-matlab-root-data-interface/7212/7 "2017-10-30T04:16:03Z")

</div>

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