Writing Comments for Simulink

How to write comments next to simulink blocks ... is it possible to have text blocks or a mouse to simulate as I need it to teach my friend on the internet and also for further self-reference?


source to share

2 answers

Please see this article page15 (i advice CTRL + F and search for "comments")

The article states that "you can add text comments anywhere in the block diagram by double-clicking and entering text."

Hope this helps and remember that Google is your friend.



There are several ways to enter comments. If the comment is included in the "whole" model and contains a good piece of text (eg documenting a function or tracking program functions in requirements) - Include a Doc Block .

The Doc block will allow you to add a lot of material and the text can be retrieved later by the reporting tool or simply double-clicked to view. The RTF option also allows formatting.

For small annotations to the model that are not associated with a specific block; double click and you get the model comment block . Once you have filled this with text, you can format it (color, shadow) to your liking and move it.

For important comments and information about a specific block, I recommend that you open the block properties and fill out the Documentation tab . If it's a relatively short comment, you can also show this text next to the block by going to the Block Annotation tab and adding%. (You will also find tons of other useful things to print out in this list, such as initial values ​​and other important parameters). These comments move with the block, which reduces the likelihood of out-of-place comments.

Another nice feature of filling out block documentation is that these comments can appear in the generated code where the block will be implemented.

Finally, one of the most powerful ways to comment out in Simulink is: Choose your block names carefully.

The block name often appears in the generated code as comments or even as variable names, it will also appear in most error / debug printouts. This way you can save yourself and other tons of time if the block name is descriptive. For this reason, even for blocks where you usually hide your name, I would recommend naming them in the Model Explorer.



All Articles