Using Doxygen with Matlab

Version 1.8.0.0 (87.4 KB) by Fabrice
Extracts automatically comments from your Matlab .m files using Doxygen to generate documentation
9.8K Downloads
Updated 6 Apr 2011

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

This package allows you to extract automatically comments from your Matlab .m files using Doxygen to generate documentation.

This package provides :
- a perl script (m2cpp.pl) used to filter the .m files so that Doxygen can understand them
- a template for the Doxyfile file (configuration file for Doxygen) which has to be modified according to the location of your code
- documentationGuidelines.m, an .m file which describes how you should comment your code so that Doxygen can extract it and create nice documentation
- classDocumentationExample.m : an .m file describing possible comment for classes
- all the documentation (html format) automatically generated by Doxygen from the two .m files (see Doc/html/index.html), which provides informations about installation and how to write Doxygen comments.

Installation details :
- You need to have the Doxygen software installed (version 1.5.9 or newer required (tested with version 1.7.1))
- You need to have perl installed (perl is shipped with Matlab, located usually in $matlabroot\sys\perl\win32\bin)
- unzip the DoxygenMatlab.zip to C:\DoxygenMatlbab (for example)
- get the Doxyfile file from the C:\DoxygenMatlbab directory and replace the default Doxyfile provided by Doxygen
- edit the Doxyfile file (or use the DoxyWizard tool provided by Doxygen) to modify a few settings :
o EXTENSION_MAPPING=.m=C++
o FILTER_PATTERN=*m=C:\DoxygenMatlbab\m2cpp.pl
o PERL_PATH=<path to your perl version>
o INPUT=<directory where your documented code is located>
o OUTPUT_DIRECTORY=<directory where you want to generate your documentation>
o STRIP_FORM_PATH=<directory where your documented code is located>

Note for Windows users :
In certain circumstances, the association between .pl files and the perl executable is not well configured, leading to "Argument must contain filename -1 at C:\DoxygenMatlab\m2cpp.pl line 4" when running doxygen. To work around this issue, you should execute the following lines in a Windows command prompt ("cmd") :

assoc .pl=PerlScript
ftype PerlScript=C:\Program Files\MATLAB\R2010b\sys\perl\win32\bin\perl.exe %1 %*
(don't forget to replace the path to the perl.exe file with yours in the line above)

Cite As

Fabrice (2024). Using Doxygen with Matlab (https://www.mathworks.com/matlabcentral/fileexchange/25925-using-doxygen-with-matlab), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Adding custom doc in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.8.0.0

Fixed a few bugs :
- property names (and method names) beginning with end are now allowed (as pointed out by Vincent)
- inheritance with classes containing a dot is now supported (as pointed out by Evgeni Pr)

1.5.0.0

Added support for :
* @-folder for classes
* multiple inheritance
* class attributes
* private / protected / public properties and methods
* abstract methods
* constant properties
* events
* ignored arguments (~)