File Exchange

image thumbnail

Documenting (help section of) an m-file

version (3.84 KB) by Guzman
This script makes a template for documenting m-files.

1 Download

Updated 22 Apr 2013

View License

This piece of code writes a template for documenting m-files. It writes the template just after the function definition header. It finds out which are the input and output arguments (if any) and writes them down in the documentation/help section.
The script also uses Malcolm Wood's subission at
to find the dependencies of the script and annotate them into the the help section.
For instance, by introducing:
>> DocFun('DocFun', 'Guzmán Díaz')
it documents 'DocFun.m' proper.
That is, it finds the input and output arguments, the dependencies, the date, Matlab version, and leaves the rest to be completed by the author.
Because things might go terribly wrong, the script makes a copy (with extension .bak) of the original file before proceeding; which must be manually deleted if results are satisfactory.

Cite As

Guzman (2020). Documenting (help section of) an m-file (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Jeffrey Chiou

Works great! Gives this warning though:
Warning: DEPFUN will be removed in a future release. Use matlab.codetools.requiredFilesAndProducts instead.
> In depfun at 258
In DocFun>i_scan at 271
In DocFun>mydepfun at 237
In DocFun at 139

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!