Comments allow a programmer to include text in their code that a computer will ignore, or not execute. Initially, it might seem unnecessary to write text other than the required executed commands. There are several beneficial reasons why Comments are a part of almost every programming language and why you should use them.
One reason to use Comments is to describe the code you have written. This way it easier for a reader to make sense of the Matlab syntax. It is common to add Comments for the details of a script like individual commands, as well as providing a high-level overview about an entire program.
Another reason to use Comments is to temporarily stop the computer from executing a command without having to entirely remove the text. This way it is possible to save a command for future use, and quickly include it again by removing the Comment.
The Matlab symbol for creating a Comment is the percent sign: %. When this symbol is included in a script, it will be the color green. This is to remind the programmer the symbol will not be interpreted when a script is run. Any text to the right of a percent sign on a line will also green, and ignored by the computer.
Next, let’s look at the included Documentation with Matlab to use as a helpful reference.