m2uml
Have you ever had (or inherited!) a lot of classes that you want to visualize in a graphical way to understand their relationships and capabilities? This submission takes a set of MATLAB classes and exports UML that can be visualized in various third party tools. I have a set of classes that I want to visualize, so I create the list and the UML:
list = {'Content.Applicator','Content.FileSet','Content.Selectors.Selector','Content.Selectors.All', ...
'Content.Selectors.ExcludeXML', 'Content.Selectors.Extension', 'Content.Selectors.File', ...
'Content.Selectors.Folder', 'Content.Selectors.Git', 'Content.Selectors.All', 'Content.Converters.Converter', ...
'Content.Converters.FilesToZip', 'Content.Converters.HTMLToWord', 'Content.Converters.MarkdownToHTML', ...
'Content.Converters.PowerPointToPDF', 'Content.Converters.SimulinkToWebview'}.';
m2uml.create_PlantUML_script('Classes', list);
This writes to a file whos contents I now pasted into a third party interpreter. The display shows me the class relationships, namespaces, as well as each method and property with icon-coded attributes. There are lots of new features in the most recent update, including full integrated documentation and nested packages (which is required for the below diagram).
MATLAB's Class Diagram Viewer in R2021a
Starting in MATLAB R2021a, MATLAB has a native
class diagram viewer. You can either call this from the command line or open it from a project. This then lets you explore hierarchies, attributes, etc. of a set of classes natively in MATLAB.
matlab.diagram.ClassViewer("Packages", "Content")
Comments
Have you wanted to visualize classes in MATLAB? Now you have two ways to do it! Give these a try and let us know what you think
here or leave a
comment for per.
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.