Can I comment a block of lines in an MATLAB file using /* ... */ as I can in C?
Show older comments
I understand that in MATLAB we can comment line by line using % but this is troublesome, especially if I have a whole group of lines that I want to comment out temporarily. Is there anyway we can 'block' comment, like in 'C' where we can use /* at the beginning of a block of comments and */ at the the end of the block?
Accepted Answer
More Answers (1)
Gaganjyoti Baishya
on 21 Jun 2020
0 votes
Yeah it can be easily done. Instead of /* use %{
and instead of */ use %}
1 Comment
Walter Roberson
on 9 Apr 2021
C and C++ permit /* */ to appear in the middle of a line and the rest of the line after the */ will be executed for them. MATLAB requires that %{ and %} be on lines by tthemselves .
Categories
Find more on Workspace Variables and MAT Files in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
