how to count uncommented ligns in matlab file?
이전 댓글 표시
Hi,
I would like to count the number of ligns of code I produced for a project.
But I don't want to count commented ligns in the file. Otherwise I know I can use the function suggested (here).
Moreover sometimes the first character is not the (%) and there are some blank spaces before
Does anyone have an idea?
Thanks a lot.
채택된 답변
추가 답변 (1개)
Image Analyst
2023년 4월 2일
0 개 추천
You can use my comment counter program, attached.
댓글 수: 3
Adam Danz
2023년 4월 2일
Would this be a good candidate for the file exchange (I haven't looked at it yet)?
There's still this thing that I built off comment_counter.m to add support for legacy versions and some other features.
This all comes from a conversation here:
thispath = fullfile(matlabroot,'toolbox/images/colorspaces/');
checkcomments('path',thispath,'direction','ascend','countblank','recursive')
Rik gets credit for the core code that actually finds the comments. If all one needs to do is isolate comments from non-comments, then that's really what they need. See checkcommProcessor() and Rik's minify code on the FEX.
Adam Danz
2023년 4월 3일
Wow, that looks useful!
카테고리
도움말 센터 및 File Exchange에서 BeagleBone Black에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!