Friday, September 3, 2010

"Publish"ing in Matlab

I use GNU Octave as the glue to post-process and make preliminary visualizations most of the time. Every once in a while, however, I need to use its commercial cousin, Matlab.

This Fall, I am teaching an undergrad numerical analysis class, and realized that Matlab has this interesting documenting feature called "Publish", which lets you use a double percent sign %% in addition to the regular % sign used to begin a comment. Using these %% signs, you can divide your code into "cells" which is helpful for selectively testing individual cells -- an added benefit.

Check out a video on how to use this feature at Mathworks.

By proper use of %% and % comments, one can actually produce a nice document (in html, LaTeX or some other options), which is ideal, since now students can submit only a single "M-file", and I can check whether the program works, and the accompanying documentation in one shot.

No comments: