in english whole site
Home·Programming·MatLab·Program Statisticsdeutsch·english·français
» Hits: 97612  (details)
» Distinct visits: 10439 (1 Hit/visit)
» Bots visits: 86972 (Hits: 89.1%)
» Your hits in this session: 1
Contact & CommentsMinimizeHigherLower
» Visitor's comments
» Contact
Program Statistics

Program_statistics v.1

Statistics about multi-file programs

This simple m-file compiles some statistics about a program.A report is printed; statistics can be returned in structure. The statistics include:
  • number of files,
  • number of functions and GUIDE-related functions,
  • number of lines, words and characters,
  • number of page to print out the whole program.

Features and Usage

stats = program_statistics(direct);
stats = program_statistics(direct, options);

  • direct: directory where the program resides
  • options: a structure with the following optional fields:
    • .recursive = 0|1 take also into account subfolders recursively
    • .complete = 0|1 compile extended set of statistics (GUIDE-related, comments related, ...)
    • .include cell array of text files types (.xxx) to include in the statistics
      (e.g. {'.txt'; '.c'})
The program will optionally return a stats structure containing all information present in the report:

% Number of folders parsed: 44
% Number of code folders: 8 (22.125 files per folder)
% Number of files: 177
% - including 588 functions (3.322 functions per file),
% - including 25 GUI dialog callback files made with GUIDE,
% (linked with .fig files weighting 657.3438 Kb)
% - including 335 GUIDE-related functions,
% - including 253 other functions (1.6645 functions per file).
% Number of lines: 40600
% - distributed in 172234 words,
% - including 2774 (6.8325%) separation lines,
% - including 8606 (21.197%) lines of comments,
% - including 29220 (71.9704%) lines of code.
% Number of characters: 1549343
% - including 407452 (26.2984%) comment characters,
% - including 1141891 (73.7016%) code characters.
% To print the whole program, 1014 A4-pages would be necessary.

Version and download

Version 1.0 - Release 21.06.04 [
Legal Stuff]

Download the function as a .m matlab file (10 Kb).


None known. Tested exclusively with MatLab R13.

Legal blahblah & Conditions of use
© CSE - L.Cavin, 2003, 2004
These libraries and functions (THE PROGRAM) are provided "as is" without warranty, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the program is with the person downloading or running the program (THE USER). Should the program prove defective, the user assumes the cost of all necessary servicing, repair or correction.
In no event will the Author or the Copyright holder be liable to the user for damages, including any general, special, incidental or consequential damages arising out of the use, peruse or inability to use the program (including, but not limited to loss of data or data being rendered inaccurate or losses sustained by the user or third parties or a failure of the program to operate with any other programs), even if the Author or the Copyright holder has been advised of the possibility of such damages.
The fact of downloading or running the program implies acceptation of the present liability limitation by the user.
These libraries and functions are free to use for non-commercial purposes and can be distributed (free of charge) as long as the copyrights notices are kept intact. In particular, if the program is distributed further by the user, the user is responsible for including this legal warning and liability limitation to the distribution.
It is also encouraged to improve these functions; please send to the author any improvements - we may want to include them in this distribution under the same conditions.

Do not be afraid, I am confident that the program will work - without warranties of course ;-)
Thanks to the Free Software Foundation for inspiring this nice little legal blahblah... My favorite part is the "inability to use"... even if the "general, special, incidental or consequential" part is also quite fun!

Made with CSE_CMS, © CSE, 2008-2021