SLOC counter

This script reads a C-File and counts the source lines of code.
707 Downloads
Updated 18 Feb 2009

No License

This script reads a C-File and counts the source lines of code (SLOC).

Following kinds of lines are not counted as source lines of code:
1) //comment
2) /*
...comment
/*
3) empty lines

to run the file:
[code_lines_nb, comment_lines_nb, empty_lines_nb] = get_sloc_cfile = get_sloc_cfile('test.c')

Cite As

Danne Spencer (2024). SLOC counter (https://www.mathworks.com/matlabcentral/fileexchange/22993-sloc-counter), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2006a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Aerospace Applications in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.1.0.0

- output also the number of comment lines and number of empty lines.

1.0.0.0