Writing Comments for Simulink
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.
source to share