필터 지우기
필터 지우기

Add comments in a standard way

조회 수: 3 (최근 30일)
Jason
Jason 2016년 3월 1일
답변: Walter Roberson 2016년 3월 1일
If we want to add commments about a line of code, in a standard/professional way, we add the comments above the code, or below the code, or in the same line of code?

채택된 답변

Walter Roberson
Walter Roberson 2016년 3월 1일
Above the code and on the same line of code, both. Above the code for explaining how sections will work. On the same line of code for brief notes about the particular line.
For example, if I am illustrating how to do edge detection, I would put comments in before the code talking about the approach. And then within that block I might have a line such as
YourImage = imread('cameraman.tif'); %replace with appropriate filename
to point out something specific about the line. I might even have written above that the user will need to replace the filename, but it helps if I comment right there that it is the line to be changed.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by