File Exchange Pick of the Week

Our best user submissions

Document Your Dependencies 4

Posted by Guest Picker,

Greg's pick this week is Using Doxygen with MATLAB by Fabrice.

Ever wanted a class dependency diagram and documentation of your MATLAB Classes. How about leveraging Doxygen to document your development project?

Fabrice provides a simple interface to make this possible. Interestingly enough, this entry doesn't actually contain MATLAB Code!

Contents

Classy Relationships

Do you want to know how MATLAB Classes are related?

inherit_graph_0

The above image shows a subset of the class hierarchy for a project I have been working on, which I was able to generate using Fabrice's tool.

The diagram depicts each class in a box. The arrow points to the parent class from which each class is inherited.

The terminus for the dependency path is a built-in class in MATLAB, which in this case is "handle".

What about the documentation?

If you use comments in MATLAB Code to document your functions and classes, then you need to apply Fabrice's extra convention of "%>" instead of just "%" to determine which comments get parsed by Doxygen.

In addition Doxygen convention is the documentation for a function by default comes before the function, which the convention in MATLAB is that it comes after the function. To make sure your documentation is available in Doxygen and using the MATLAB DOC function, then you likely want to consider using the "<" flag in your first comment after a MATLAB Function or class parameter definition.

I did make a quick modification of the Perl script in Fabrice's entry to automate that process so that "%>" was replaced by "///<" and make the assumption that MATLAB Documentation always comes after the function or parameter definition.

Documentation is already available using MATLAB

There is already a documentation mechanism available in MATLAB already. As well as the ability to display custom documentation as part of the MATLAB Documentation system.

You can use comments in your MATLAB code to generate documentation without any additional work. However it doesn't provide much in the way of developing dependency graphs.

Is this something that should be in MATLAB or Simulink?

  • Do you use Doxygen to document your software development projects?
  • Should this be a capability built into MATLAB or Simulink?
  • What about generated C or HDL-code?
  • Do you use a different method for using Doxygen with MATLAB?

Let us know here.


Get the MATLAB code

Published with MATLAB® 8.6

33 views (last 30 days)  | |

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.