how to count uncommented ligns in matlab file?
Afficher commentaires plus anciens
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.
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 2 Avr 2023
0 votes
You can use my comment counter program, attached.
3 commentaires
Adam Danz
le 2 Avr 2023
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
le 3 Avr 2023
Wow, that looks useful!
Catégories
En savoir plus sur BeagleBone Black dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!