Count numer of lines in a MATLAB script, ignoring comments and blanks
Show older comments
Is there a way to count the number of lines in a MATLAB script or function, but not count blank and comment lines?
1 Comment
Walter Roberson
on 6 May 2019
There is no supplied way to do this.
If you do this yourself you need to watch out for %{ %} multi line comments
Fortunately matlab does not permit literals to be split between lines so you do not need to worry about ... sequences potentially hiding the fact that a line starting with a % might hypothetically be part of a string rather than a comment.
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!