matdoc is a package to deliver solutions to document your matlab code more automaded.
- Export of plantUML pseudo code for classes and packages
Clone and add the root folder to the matlab search path.
Before we can export and documentation or plantUML code, we need to define which classes or packages we want to document. This work is done by the Documentation class. Simply call it with a cellarray of class or package names you want to document. Here is an example:
theDoc = matdoc.Documentation({...
'matdoc.Configuration',... a class we want to document
'matdoc.Documentation',... another class we want to document
'matdoc.enums',... a package we want to document
'matdoc.meta.super',... jet another package we want to document
'matdoc.tests.testTools',... and some unittest class to end it
});
Now let's save the UML Diagram to a txt file of these 2 classes and the 2 packages and their containing classes:
theDoc.UmlToFile('uml-diagram.txt');
The output can be seen here: uml-diagram.txt
With a plantUML editor of your choise (see chapter below) you can now create beautiful class diagrams:
The output will be configured via additional arguments to the matdoc.Documentation constructor. The settings have to be passed as key value pairs.
theDoc = matdoc.Documentation({...
'matdoc.meta.Class',...
'matdoc.enums.AccessLevel'...
},...
'IgnoreBuiltInClass', true... <-- additional configuration arguments
);
Alternatively the configuration may be edited directly via the properties of the config:
theDoc = matdoc.Documentation({...
'matdoc.meta.Class',...
'matdoc.enums.AccessLevel'...
});
theDoc.Configuration.IgnoreBuiltInClass = true;
For further reference about the available settings please have a look at the Configuration Examples.
When it comes to displaying the produced plantUML there are several options:
- Online Viewer
- Local Installation
- plantUML.jar from plantuml.com
Make sure you have GraphViz installed! And by installed I mean properly installed. Remember that you'll have to set the path variable in windows! - plantuml-viewer for the Atom editor
- plantUML.jar from plantuml.com
See the F.A.Q. Section