slocdir( directoryPath )

Go recursively into folders to count the .m lines of code

You are now following this Submission

A simple recursive function which uses the sloc function to count the number of lines of .m code.
The sloc function can be found here : http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=3900&objectType=file

Cite As

Diffy D (2026). slocdir( directoryPath ) (https://ch.mathworks.com/matlabcentral/fileexchange/24000-slocdir-directorypath), MATLAB Central File Exchange. Retrieved .

Acknowledgements

Inspired by: sloc

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.1.0.0

Fix a bug, change strcmp to strcat in the warning

Updated accordingly with the comments given by users

1.0.0.0