File Exchange

## Using Doxygen with Matlab

version 1.8 (87.4 KB) by

Extracts automatically comments from your Matlab .m files using Doxygen to generate documentation

4.48148
30 Ratings

Updated

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) ### Comments and Ratings (72) Simone Gaiarin ### Simone Gaiarin (view profile) Since this code has not been updated since 2011, I've update this code to a github repository. I hope people will contribute to it in terms of code and documentation. Here is the code: https://github.com/simgunz/doxymatlab I'll try to include some of the patches proposed below. Thom DeCarlo ### Thom DeCarlo (view profile) Using this on OS X required a couple modifications. 1 - change "/usr/bin/perl.exe" to "/usr/bin/perl" 2 - run dos2unix on m2cpp.pl Also, as noted on 18 Nov 2010 by Guillaume JACQUENOT, function declarations with continued lines ("...\n") do not work properly. Otherwise, this script has been a great help! mmeyer89 ### mmeyer89 (view profile) Useful work, however it did not work well with namespaces. Here is my fix. 1. Add in the beginning of m2cpp following code # Extract namespace my$namespace = '';
foreach(split /\//, $fname) { if($_ =~ /^\+/) {
$namespace =$namespace.substr($_, 1).'.'; } } 2. Set$namespace as prefix to $className Example: Replace$classDef = "class ".$className.":public$classInheritance";
by
$classDef = "class ".$namespace.$className.":public$classInheritance";

The inherits are detected correctly and the list of classes is also grouped by namespace. I'm happy with the result.

Felipe Viana

### Felipe Viana (view profile)

Great contribution. Thanks!!!

Manpreet Dhimam

### Manpreet Dhimam (view profile)

Hello,

I am generating a Doxygen documentaion for .m file.Firstly I generate it by simply editing the doxygen.conf file, I add FILE_PATTERNS= .m and EXTENSION_MAPPING= .m=c++. But it did not produce correct documentation of .m file. Now I am following your post "Using Doxygen with matlab and download "Doxygenmatlab" package. I have tried to understand all things, But unable to understand. Guide me what I have to do?

iamnotshaw

### iamnotshaw (view profile)

possible typos in the instructions and doxyfile. should be FILTER_PATTERNS

otherwise doxygen ignoring the tag

Ingo

### Ingo (view profile)

Great file, using it since a long time.

However, now finally changed to Windows 7 I get the error/warning message warning: "Warning: Found ';' while parsing initializer list! (doxygen could be confused by a macro call without semicolon)" and my .m files are not parsed any longer. Do anybody know the workaround?! (Sonsoles earlier had the same problem but didn´t posted the solution;-()

Simone Gaiarin

### Simone Gaiarin (view profile)

This script is great!

It would be fantastic to have also a method to generate the source browser correctly with the comments stripped.

I've tried to strip the comments from the source files with a perl filter used in FILTER_SOURCE_FILES. But then the hyperlinks from the documentation to the code are wrong.

Any suggestion on how to do this?

Steven

### Steven (view profile)

I realized that comment in the function is not possible to extract by this filter even with "%>"
And function output parameter does not reveal in the documents also, if using a "..." for line break in the function name, the filter cannot parse it correctly.

Steven

### Steven (view profile)

Cool and thanks! I finally make it work. Keep stuck at the error "Argument must contain filename"

I fix it using this solution

http://stackoverflow.com/questions/4234581/argv-is-empty-using-activeperl-in-windows-7

Option1 does not fix it well, but option2 does the trick.

Mark Mikofski

### Mark Mikofski (view profile)

Thank you for creating this Fabrice.
I will take a look at it and provide feedback.

Eckard

### Eckard (view profile)

Hello Fabrice.

My name is Eckard Klotz. I\'m the developer behind the two sourceforge projects:
Moritz : http://sourceforge.net/projects/moritz/
MuLanPa : http://sourceforge.net/projects/mulanpa/

Both are open source freeware-projects and should be used as an extension of Doxygen to create algorithm describing diagrams like nassi shneiderman or uml activity diagrams.

Today in both projects.
The snapshot of the project Moritz
http://sourceforge.net/projects/moritz/files/Snapshots/2013_05_27/
contains in the windows-distribution Moritz2_WIN32_2013_05_27.zip
in the folder LangPack\pascxal your filter. You will find in the file

The following paragraphs:

Since this distribution contains doxygen-configurations also and
with the version 1.9.08 the languages Matlab and Pascal are
supported also two third-party filters are added in the associated
LangPack folders:

Matlab:
Filter: m2cpp.pl
Author: Fabrice
Internet:
http://www.mathworks.com/matlabcentral/fileexchange/25925-using-doxygen-with-matlab

Pascal:
Filter: pas2dox.exe
Author: Darren Bowles
Internet: http://sourceforge.net/projects/pas2dox

I hope that this is OK for you but please don't hesitate to argue if you

Best regards,
Eckard Klotz.

Sonsoles

### Sonsoles (view profile)

Now it is working in my matlab but i want to know if with this GraphViz options are available. i mean class graphs and caller graphs among others.
Thanks again

Jason

### Jason (view profile)

I had to update m2cpp.pl for line endings on my Mac. In VIM, I used ":set ff=unix" and that did the trick.

Sonsoles

### Sonsoles (view profile)

Hello!! i am runing Doxygen in my matlab code and the question is, it should show some graph as well.
i got the following errors:
C:/Users/Sonsoles/Documents/Fortran/Kompressorkoden/get_o_over_c.m:23: warning: Found ';' while parsing initializer list! (doxygen could be confused by a macro call without semicolon)
C:/Users/Sonsoles/Documents/Fortran/Kompressorkoden/get_omega_s.m:21: warning: Found ';' while parsing initializer list! (doxygen could be confused by a macro call without semicolon)
C:/Users/Sonsoles/Documents/Fortran/Kompressorkoden/Xfunc.m:21: warning: class for member M::::::calculate:' cannot be found.

thanks for the help

Aurelien Queffurust

### Aurelien Queffurust (view profile)

I am under Windows XP R2011b. When I run Doxygen , the perl file m2cpp.pl shows up on the screen for each M-file that is processing. I have to close the file manually.
Moreover , your perl file requires to change all our syntax since the filter extracts only lines beginning with %>. For function description, same issue , we have to use a specific syntax.

The other submission "mtoc++ - Doxygen filter for Matlab and tools " is better , it doesn't require any change in our codes.

I definitely prefer m2html which is plug and play.

Håkan Håkan

### Håkan Håkan (view profile)

Hello Fabrice!

Finally - poh - I have m2cpp running in Windows 8 with Matlab 7.0.4!

First I had problems with access rights for involved programs, had to set Run as administrator, also had to patch in registry to make perl accept command line arguments.

Then m2cpp.pl crashed at row 43. After having modified by inserting
"use FileHandle;" at first row
and replaced row 43
"open(my $in,$my_fic);"
by
"
my $in = new FileHandle; # Fix for old version of Perl$in-> open($my_fic); " things run nicely!!! Thanks for your submission Håkan Fridén hakan.friden@frideninfotech.eu Peter ### Peter (view profile) Question: Is this supposed to work for call graphs, like on M2HTML? The *inheritance* graphs are being generated properly. But I don't see any call graphs for any of my functions or class methods. Thanks Snowred Wang ### Snowred Wang (view profile) ok I just found out that I have to use the \fn keyword with the input name written exactly the same as what m2cpp generates. For example, I need to add a line saying %> \fn my_func_name(in par1,in par2) Thanks for m2cpp a very nice work! Snowred Wang ### Snowred Wang (view profile) I'm trying to use it with doxygenwizard 1.8.2 under windows 7. I believe that I've followed all instructions but I just got an empty index.html page. What might be the problem? Below are my logs Adding custom extension mapping: .m will be treated as language c++ Searching for include files... Searching for example files... Searching for images... Searching for dot files... Searching for msc files... Searching for files to exclude Searching for files to process... Searching for files in directory C:/Project/xxx Reading and parsing tag files Preprocessing C:/Project/xxx/xxx1.m... Parsing file C:/Project/xxx/xxx1.m... Preprocessing C:/Project/xxx/xxx2.m... Parsing file C:/Project/xxx/xxx2.m... Building group list... Building directory list... Building namespace list... Building file list... Building class list... Associating documentation with classes... Computing nesting relations for classes... Building example list... Searching for enumerations... Searching for documented typedefs... Searching for members imported via using declarations... Searching for included using directives... Searching for documented variables... Building member list... Searching for friends... Searching for documented defines... Computing class inheritance relations... Computing class usage relations... Flushing cached template relations that have become invalid... Creating members for template instances... Computing class relations... Add enum values to enums... Searching for member function documentation... Building page list... Search for main page... Computing page relations... Determining the scope of groups... Sorting lists... Freeing entry tree Determining which enums are documented Computing member relations... Building full member lists recursively... Adding members to member groups. Computing member references... Inheriting documentation... Generating disk names... Adding source references... Adding xrefitems... Sorting member lists... Computing dependencies between directories... Generating citations page... Counting data structures... Resolving user defined references... Finding anchors and sections in the documentation... Combining using relations... Adding members to index pages... Generating style sheet... Generating example documentation... Generating file sources... Generating file documentation... Generating page documentation... Generating group documentation... Generating class documentation... Generating namespace index... Generating graph info page... Generating directory documentation... Generating index page... Generating page index... Generating module index... Generating namespace index... Generating namespace member index... Generating annotated compound index... Generating alphabetical compound index... Generating hierarchical class index... Generating member index... Generating file index... Generating file member index... Generating example index... finalizing index lists... symbol cache used 16/65536 hits=192 misses=16 lookup cache used 0/65536 hits=0 misses=0 finished... When enabling GENERATE_HTMLHELP the search engine (SEARCHENGINE) should be disabled. I'll do it for you. *** Doxygen has finished Sebastian Pliefke ### Sebastian Pliefke (view profile) Sebastian Pliefke ### Sebastian Pliefke (view profile) Hi, I really like the doxygen integration and I'll use it from now on. Only a minor feature is missing from my point of view. I would like to comment on class variables after the definition and not before. Is that somehow possible or is there a quick fix to enable the tool for that? e.g. classdef CameraModel properties ImageSize = [640 480]; %> Camera image size in pixel [x y] end end Sorry I'm not really familiar with perl so that I couldn't do it by myself. Sebi Giovanni ### Giovanni (view profile) Actually someone helped me already to solve the problem. The file m2cpp.pl is formatted for DOS. One has to reformat it for Linux in order to get everything to work correctly (I did it with the tofrodos package). The program is great :-) Giovanni ### Giovanni (view profile) It *almost* works for me and I suspect it may have to do with a Linux problem. I receive the following error messages sh: /media/sda5/Giovanni/Utilities/Matlab_utilities/Matlab_exchange_downloads/DoxygenMatlab/m2cpp.pl: not found and the html files after this do nto contain any documentation (as no c++-style comments are produced). The m2cpp.pl is there, though, I have tried to move it around and I still receive corresponding error messages. Could anyone tell me where I have to start looking for solving this problem? Thanks in advance. Aguilar ### Aguilar (view profile) Great contribution, thanks a lot! Tom ### Tom (view profile) Dear Fabrice, is your package able to document code that uses the old class specification (before use of "classdef")? Thanks a lot, Tom Brian ### Brian (view profile) Eckard ### Eckard (view profile) Hello everyone I get an error by using the pearl-script like follows: Reading and parsing tag files Preprocessing D:/Daten/Projekt../src/fcn.m... Can't use an undefined value as filehandle reference at D:\Daten\Projekt\..\Filter\m2cpp.pl line 47 (formaly line 53). Parsing file D:/Daten/Projekt/../src/fcn.m... I tried to implent the patches from Bastian (07.07.2011) but the only the line-number changed from 43 to 47. I use the pearl-version of Matlab 2009b on windows XP-SP3 together with Doxygen version 1.7.4 Thanks for your help, Eckard Klotz. Bastien ### Bastien (view profile) Fabrice, thanks again for this wonderful script. It would be a nice improvement to have some options to be able to hide some information in the documentation: -> hide the Hidden methods/properties for the public APIs. -> hide the set.my_property/get.my_property methods in the classes that are useless in the documentation Bastien ### Bastien (view profile) Fabrice, I have solved the previous package problem modifying the PERL script m2cpp.pl: at line 42 (after the foreach$my_fic)
$packages = ""; if ($my_fic =~ /^[^\+]*\+(.*)[\/\\].*\.m/g){
$packages =$1.".";
$packages =~ s/[\/\\]\+/\./g; } at lines 176 and 180 (when defining$classDef:
replace: $classDef = "class ".$className
by: $classDef = "class ".$package.$className With this patch, your code will be compatible with the Matlab Packages! Bastien ### Bastien (view profile) Fabrice, thanks for this nice script. However, is it possible to include support for packages? For example, if you have: ./+PackageName/ClassName.m ./ChildClassName.m where ChildClassName < PackageName.ClassName, then the script combined with Doxygen will create 2 different pages for ClassName: - one for ClassName containing the definitions of all methods and properties - one for PackageName.ClassName containing no definition at all (just the inheritance relational graph) Maybe you could use C++ namespaces to solve this bug? (or maybe Java packages are more suited to implement nested packages like ./+Package1/+Package2/MyClass.m) thanks a lot in advance if you can help with this! PS: for those like Cedric who have some troubles with the "< handle" inheritance, you must UPDATE your Doxygen installation :-) Ian ### Ian (view profile) Wonderful interface to doxygen, very easy to implement. One very small niggle is the shebang at the top of the perl script in the latest update points to perl.exe -- this needs to be edited before it will work on *nix / OS X... LeFlaux ### LeFlaux (view profile) Fabrice, thank you for your quick response. The flag was already set to YES. However, in the meantime I realized that doxygen works for private directories located in standard folders but not in class folders: foo/private/stuff.m % works foo/@myclass/stuff.m % works foo/@myclass/private/stuff.m % won't appear in doxygen Regards Fabrice ### Fabrice (view profile) LeFlaux, I guess you problem is a Doxygen issue (maybe the EXTRACT_PRIVATE is set to NO in your Doxyfile). If not, could you send me a test case so that I can reproduce your problem ? LeFlaux ### LeFlaux (view profile) Dear Fabrice, thank you for this great and useful piece of software! Just one little question: I got directories named private' in my Matlab-project. The documentation of .m files contained in such directories are not displayed. Any suggestions? Vincent ### Vincent (view profile) The same problem (see the post of the 11 Mar 2011) happens when the attribute name begins with "end" (for instance "endDate"). guillaume ### guillaume (view profile) Thx a lot for this great tool ! Vincent ### Vincent (view profile) I experienced a little problem when using it on "@" folder class definition. As strange as it looks, when the name of my function (defined in an external .m file inside the @ folder) begins with a "m" letter, the function does not appear in the generated class description. It works just fine when I change it in another letter. Any idea? thanks Evgeny Pr ### Evgeny Pr (view profile) Hi Fabrice, I noticed a small problem. At multiple inheritance from a class from a package-directory the base class name is defined incorrectly. For example: +My - package-directory BaseClass.m - base class in +My directory SomeClass.m - some class in +My directory "SomeClass" define: classdef SomeClass < My.BaseClass end When you create a documentation obtained that SomeClass is inherited from the "My", a not from "My.BaseClass" or "BaseClass". :) Fabrice ### Fabrice (view profile) Hi Cedric, - the inheritance syntax (classdef MyClass < handle) is fully supported by the m2cpp.pl script : could you send me a test file so that I can see why you experienced such errors using this syntax ? - your second problem is an encoding configuration issue in your Doxyfile (you shouldn't use the UTF-8 encoding but probably the ISO8859-1 encoding) Regards, Fabrice Cedric Boudinet ### Cedric Boudinet (view profile) It seems good, however I do encounter some problems: one of my scripts is a classdef deriving from 'handle' : classdef MyClass < handle the parser gives an error since < is not closed by a > Is there a way to avoid this ? Another problem is that the parser gives errors on non-ascii letters (é, è, ...) Jack ### Jack (view profile) I've been using and enjoying your product. I have a quick question though. 1)I am using Matlab 2007a with only fuctions, i.e., not classes. I cannot get doxygen to create any graphs, either using graphviz or the included graphing library. I'm familiar with doxygen, and was wondering if your product in conjunction with doxygen supports graph generation via function calls alone? I uses a similiar perl script posted somewhere online to convert from .m to .c and it could generate graphs in doxygen. Thank you for your time, the .m is included below, in which no graph is generated (I have graph generation enabled in doxygen and all the setting in expert are correct aslwell I believe). %> @brief Brief description of the function %> %> More detailed description. %> %> \latexonly %>$\bigl(\begin{smallmatrix}
%> a&b\\ c&d
%> \end{smallmatrix} \bigr)$%> \endlatexonly %> %> @param arg1 First argument %> @param arg2 Second argument %> %> @retval out1 return value for the first output variable %> @retval out2 % ====================================================================== function [out1, out2] = hhh( arg1, arg2) out1 = arg2; out2 = arg1; c = fb(out1); end % ====================================================================== %> @brief Brief description of the function %> %> More detailed description. %> %> \latexonly %>$\bigl(\begin{smallmatrix}
%> a&b\\ c&d
%> \end{smallmatrix} \bigr)$%> \endlatexonly %> %> @param arg1 First argument %> %> @retval out1 return value for the first output variable % ====================================================================== function [out1] = fb( arg1) out1 = arg2; end 2) when I use /latexonly /endlatex only Doxygen commands to put in a matrix in latex, my matrices/equations have the "///" comment denoted for c++, this is not a problem, but if there is an easy fix I'll like to know. Mikhail Konnik ### Mikhail Konnik (view profile) Thanks for the update, Fabrice! Works perfect. Linux users may find my tweaked Doxyfile for this m2cpp.pl tool useful: http://mikhailkonnik.pbworks.com/w/file/matlab2doxygen.zip By the way, does anybody know how to add citations to the documentation from Doxygen using LaTeX? I mean, one have \cite commands in the documentation, and those cited sources should appear in the doxygen-generated docs. Any ideas? LeFlaux ### LeFlaux (view profile) Just awesome! :) Thank You very much for this tool! Note on m2cpp.pl: Linux users should change the first line to #!/usr/bin/perl Guillaume JACQUENOT ### Guillaume JACQUENOT (view profile) This seems a good function. I notice a small bug When I declare a function on several lines, the different arguments are not recognized For example, something like this will produce warning, and won't be correctly displayed %> @param AAAAAA %> @param BBBBBBBB %> @param CCCC %> @param DDDDDDDD %> @param EEEEEEEEEE %> %> @retval Res return value for the first output variable %> @retval RTex return value for the second output variable function [Res,RTex] = Compute_residual(AAAAAA,BBBBBBBB,... CCCC,... DDDDDDDD,... EEEEEEEEEE) Fabrice ### Fabrice (view profile) I have just updated the m2cpp.pl script to better support : - @-folder class definition - multiple class inheritance (classdef a < b & c) - classes attributes (Sealed, Hidden,...) - events (transformed into enum Events in the generated documentation) - private / protected / pubic methods - private / protected / pubic properties - constant properties (with their initialization) - abstract classes (transformed into virtual functions in the generated documentation) - the ignored argument (~) in function declaration is now read and transformed into an ignoredArg in the generated documentation Evgeny Pr ### Evgeny Pr (view profile) Fabrice, please, update your files on fileexchange. Last version works fine! Simon Prince ### Simon Prince (view profile) Great utility, thanks. Question about using it with multiple-file classes - I get it to work with a class in a single file, but when I set up a class in an @folder, I don't seem to get the function based methods (in separate files) located within my doxygen derived class. green_fr ### green_fr (view profile) Another strange point with inheritance. Imagine class Father inherited by two classes Son1 and Son2. In Father there is a method Father::doIt() overloaded by Son1::doIt(), but inherited directly from Father by Son2. The strange point is that in Son2 documentation you’ll see comments about Father::doIt() (that is normal) followed by «Reimplemented in Son1» (that is weird — or may be this is a standard C++ documentation agreement ?) green_fr ### green_fr (view profile) I mean, with a brief form of abstract methods. With the following example : methods (Abstract) function calcPMInitiale(obj) end projection(obj, iteration) end The first method will be detected, but not the second (correct definition for MatLab). green_fr ### green_fr (view profile) But I think it doesn't work properly with abstract methods... green_fr ### green_fr (view profile) Evgeny Pr ### Evgeny Pr (view profile) A small correction to define classes (classdef (Hidden, Sealed) SomeClass) are handled correctly: if (/(^\s*classdef)\s*(\s*$$[\w,\s]+\s*$$)?\s*([\w\d_]+)\s*<?\s*([\w\d_]+)?(.*)/) Evgeny Pr ### Evgeny Pr (view profile) I think the problem with this line in the file "m2cpp pl": if (/(^\s*classdef)\s*(\s*$$Enumeration\s*$$)?\s*([\w\d_]+)\s*<?\s*([\w\d_]+)?(.*)/) "Enumeration" is undocumented attribute? I've corrected as follows: if (/(^\s*classdef)\s*(\s*$$[\w]+\s*$$)?\s*([\w\d_]+)\s*<?\s*([\w\d_]+)?(.*)/) and added the else condition: ... else {$className = $3;$classDef = "class ".$className.":public$4";
}

This works, but I think it is not quite correct.

Evgeny Pr

### Evgeny Pr (view profile)

Hello!

I've found a bug.
Define a class with attributes:
classdef (Hidden) SomeClass < handle
end
...or with any other class attribute.
Such a definition is Parsed incorrectly.

Fabrice, You could fix this bug?
I don't understand anything in Perl. :)

Evgeny Pr

### Evgeny Pr (view profile)

Hello!
Do not use Perl, which comes with Matlab! It does not work correctly. Use ActivePerl.

Erik Gudmundson

### Erik Gudmundson (view profile)

Thank you, Fabrice, for a really nice tool! It seems, as Felix has noted, that only classes contained in one single .m-file are supported, and not the folder (@-)structure. Furthermore, the private class-properties are displayed as public ones. Is there any chance that you could fix this? I'm aware that the Matlab style of Access, SetAccess, and GetAccess might be tricky, but it would be really helpful. Thanks a lot!

Mike

### Mike (view profile)

Does this tool handle collaboration diagrams? When a class is composed using another class, it does not show up in the collaboration diagram. The collaboration diagram is always the same as the class diagram. Am I doing something wrong?

Felix

### Felix (view profile)

Thank you very much for this great tool.

Could it be that class hierarchies are not properly detected when the classes are in a package?

Matt McDonnell

### Matt McDonnell (view profile)

Fabrice,
Thanks for looking in to this, changing the extension from m to .m fixed the problem with 1.7.1.

Fabrice

### Fabrice (view profile)

Matt,
I tried to use Doxygen 1.7.1 and I suppose I reproduced your problem.
I guess this is a Doxygen bug, but as a workaround, you could try to change the value of EXTENSION_MAPPING in the Doxyfile :
EXTENSION_MAPPING=.m=C++ (don't forget the dot before the 'm').
Could you tell me if it solved your problem ?

Matt McDonnell

### Matt McDonnell (view profile)

Very nice tool - many thanks!
I found I had to use Doxygen 1.6.1, not 1.7.1 (latest).
I see from http://stackoverflow.com/questions/2701671/problem-with-input-filter-using-doxygen-1-6-3-on-windows-xp
you've seen something similar before.

Fabrice

### Fabrice (view profile)

Ed,
I changed the m2cpp.pl file so that unix users can use it.

Ed

### Ed (view profile)

I had a problem using the script under Unix (Linux) since the first line of the perl script, which defines the interpreter to use (/usr/bin/perl), was terminated using a carriage-return (\r) instead of a line feed (\n). Because of this the perl interpreter could not be found. Since the first line only makes sense in a Unix environment, I think the line-ending character for the first line (at least) should be changed to a line-feed.

Fabrice

### Fabrice (view profile)

Mike, you can comment only variables outside function block (this is a Doxygen limitation), that is :
- arguments passed to functions, for example :
%> @brief Description of the foo function
%> @param a this is a description of var a
%> @param b this is a description of var b
function foo(a, b)
...
end

- properties in a classdef definition, for example :
classdef foo
properties
%> this is a description of the var a
a
%> this is a description of the var b
b
..
end
...
end

Mikhail Konnik

### Mikhail Konnik (view profile)

Fabrice, thank for the program!
The only question I have: is it possible to comment variables by such script? I mean, if I have

a = [1,2,3,4]; %> this is a description of the var

can it be displayed in doxygen-generated docs?

Fabrice

### Fabrice (view profile)

Lien-Chi,

Maybe your perl exe is not properly installed (it seems it is the case for the perl provided by Matlab). You could try the following workarounds :

1. Set the following variables in the Doxyfile :
INPUT_FILTER=perl m2cpp.pl
FILE_PATTERNS=*.m

2. If it doesn't work you should try to install ActivePerl : with this version of perl, everything is working fine.

Lien-Chi

### Lien-Chi (view profile)

Why I got the following message? "Argument must contain filename -1 at C:\Users\user\Desktop\DoxygenMatlab\m2cpp.pl line 4"

Joydeep

### Joydeep (view profile)

Nice! Would be useful if it can also generate enum classes by handling something like this,

classdef(Enumeration) Color < int32

enumeration
Red(0)
Green(1)
Yellow(2)
end

end

Joydeep

Raymond

### Raymond (view profile)

This is exactly what I was looking for, and to see that it works on subfunctions and object oriented code is simply brilliant. This is a wonderful replacement to mtoc that works wonderfully. Many kudos to the author for simplifying my life and increasing my productivity. Brilliant!