Modules
depgraph
doctool
drawlayout
genhtml
graphlayout
makefig
makehtml

mdoc

mdoc is a little tool that automatically creates documentation for Matlab m-files, inspired by tools like Java's javadoc feature. mdoc analyzes the dependencies between various m-files and then displays them as a graph like the one below, or as a system of HTML files like the one you are looking at. The graphical representation is a GUI; if you open it with Matlab, you can click on the names of modules, and their help strings will appear in Matlab's help window.

There exists another Matlab documentation tool, Ocamaweb. Ocamaweb and mdoc are basically orthogonal to each other; Ocamaweb creates detailed documentation for a single m-file, while mdoc provides a good overview of a package consisting of many m-files. You can easily tie Ocamaweb's output into HTML files generated by mdoc. The necessary code is below.

If you want to use mdoc, simply download the file mdoc.zip and unpack it in some directory that should be included in Matlab's path. In order to see mdoc in action, start Matlab and cd into your mdoc directory, then type makefig({'makefig','makehtml'}); at the Matlab prompt. The function that creates HTML documentation is called makehtml.

A few comments:
  • If you would like to see a rather complex example of mdoc in action, look at the documentation page of Iode.
  • Unfortunately, mdoc does not work with Octave because the computation of dependency graphs hinges on the command depfun, which Octave doesn't know.
  • mdoc's HTML output is meant to be used with Genpage - Version: 1.0.7. Like this, the complexity of mdoc's HTML generator is minimal, but one can still control the layout via Genpage.
  • The layout generator for graph representations starts with a random placement of vertices, and if you're unhappy with the result, you may try again, hoping to reach a better layout from a different starting position.
  • mdoc is available under the GNU General Public License.

Dependency graph for mdoc

mdoc dependency diagram

A typical template file for mdoc and Genpage

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional">
<!-- $Id: template.html,v 1.7 2003-01-08 16:47:15-06 brinkman Exp $ -->
<html>
<head>
<meta name="generator" content=
"genpage, see www.freddyfrog.com/hacks/genpage">
<title><!-- _GP_ content("title") --></title>
<link rev="author" href="mailto:brinkman@math.uiuc.edu">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="language" content="en">
</head>
<body bgcolor="#ffffff">
<table>
<tr>
<td bgcolor="#88ddff" valign="top">
<table>
<tr><th>Dependencies</th></tr>
<!-- _GP_ content("dependencies") -->
</table>
</td>
<td valign="top">
<pre>
<!-- _GP_ content("helptext") -->
</pre>
</td>
</tr>
</table>
</body>
</html>

If you want to tie a PDF file generated by Ocamaweb into mdoc's HTML code, you can add a link like the following one to your template file:

<a href="<!-- _GP_ content("title") -->.pdf">Ocamaweb documentation</a>

Peter Brinkmann, $Date: 2003-01-09 15:29:05-06 $