All ProgramsCAEMatLabMatLab Programming

How To Make A Comment Line In MatLab® Code(Illustrated Expression)

In general, the software languages have generally a special symbol that the coder can insert a comment about codes inside the code paper. This is a very useful thing in coding because other readers of these codes could understand much more easily what all code lines inside the whole code paper mean. Also, the Matlab® coding language has a special symbol that is used as inserting comments inside the Matlab® codes. Sometimes as you know, the codes inside Matlab® could be very intricate so understanding the meaning of code lines inside Matlab® codes could be troublesome. By inserting a comment line inside your Matlab® code could overcome this situation. Below, you could see how a comment line in Matlab® is made.

YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!

Which Symbol In Matlab® Makes A Comment Line?

a = 3; %the value of a
b = 5; %the value of b
c = a*b; %the multiplication of a and b

As you can see from the very basic code lines in Matlab®, the comment lines are produced by using the ‘%’ symbol. So with this symbol, you could insert your comments to your Matlab® codes like the example above. Comment lines are not affecting your Matlab® code and these comment codes are generally used for explanation of codes inside the Matlab code.

In this example, we explained the whole variables by using the ‘%’ symbol next to them in Matlab®. Another user of this Matlab® code could understand what the whole variables inside this Matlab® code mean.


Do not forget to leave your comments and questions below about the comment lines in Matlab® below. 

If you want further coding examples about the comment lines in Matlab®, inform us in the comments.

This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®

Your precious feedbacks are very important to us.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button