M-file Header Template

Promotes better m-file documentation by encouraging authors to produce informative headers.
14.2K Downloads
Updated 14 May 2004

View License

To contribute to better standards of m-file documentation on the MATLAB Central File Exchange, I am proposing a template m-file header.

The template starts with the H1 line, followed by a few lines to describe what the function does in greater details, the calling syntax, a description of each input and output variable, a practical example of function usage, information concerning other m-files or mat-files that may be required for this function to run, and a "See also" line leading to closely related functions. This ends the block of header lines that are displayed in the command window by typing "help function_name".

After an empty uncommented line, a second block of commented lines presents information about the author: name, job title, email, website, dates of file creation and last file modification. Finally, there is a %---Begin code --- line and a % --- End code --- line.

I have surely overlooked to include information that other m-file authors consider essential. If you have suggestions to improve the template, I would appreciate hearing about them and I will try to include them in a future version. Please do not make a separate submission on the File Exchange for relatively minor modifications to this template. New submissions on the File Exchange that are based on existing submissions should only be considered when major changes in functionality are offered by the new submission (IMHO).

You should edit template_header.m and save a customized version of it containing your own personal info, as shown in template_dg.m. This will save you from typing repetitive author info each time you create a new m-file.

Cite As

Denis Gilbert (2024). M-file Header Template (https://www.mathworks.com/matlabcentral/fileexchange/4908-m-file-header-template), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Adding custom doc 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.0.0.0