## Handy software for automatically documenting MATLAB code

I’ve spent a good part of the past two years writing MATLAB code for EEG analysis (some of which is freely available as the ERP Mass Univariate Toolbox) and somewhat recently stumbled across a handy software package for automatically generating documentation for a set of MATLAB functions. The software is called M2HTML (http://www.artefact.tk/software/matlab/m2html/), and, true to its name, it generates a set of interlinked HTML pages from the MATLAB M-files in a branch of directories. Specifically, you get an index page that lists all the M-files and then a page for each M-file that can contain information such as the help header for that function and a list of functions called by that M-file and functions that that M-file calls. You can see an example of this at the Chronux Toolbox’s website. In addition, M2HTML produces a dependency graph like the one below, which illustrates which functions call which other functions.

To me, the most helpful aspect of M2HTML is that it makes clear function interdependencies. This is a huge help when I update a function, since I can clearly see what other functions might consequently need to be updated as well. It also helps when trying to make sense of the flow of processing in other people’s MATLAB software packages.

If your personal MATLAB code for a project has grown beyond a dozen or so interdependent functions or if you’re trying to wrap your head around someone else’s rat’s nest of MATLAB functions, I recommend checking it out. It should take just a few minutes to figure out and apply.

-David Groppe

[…] See the rest here: Handy software for automatically documenting MATLAB code « Spikes … […]

Handy software for automatically documenting MATLAB code « Spikes … | 零度季节 said this on June 5, 2011 at 8:59 am |