Code covered by the BSD License  

Highlights from
Generate a new function m-file, with documentation

4.0

4.0 | 1 rating Rate this file 9 Downloads (last 30 days) File Size: 3.11 KB File ID: #27225
image thumbnail

Generate a new function m-file, with documentation

by Richie Cotton

 

12 Apr 2010 (Updated 12 Apr 2010)

This makes it really easy to document your functions in a standard format.

| Watch this File

File Information
Description

Having your m-files documented in a standard way (or at all!) is very useful for sharing code between projects, and between people. The trouble is, clicking File -> New -> Function doesn't give you much to go on, and it is very easy to be lackadaisical about writing thorough and consistent documentation.

GenerateFunctionMFile() creates a new untitled m-file with placeholder documentation, and opens the file in the editor.

GenerateFunctionMFile(true), works as above but prompts you for the name of the function.

The layout includes $Author, $Date and $Revision tags, which are automatically completed for you. If you use CVS or SVN as your version control system, then checking in your file will automatically cause these fields to be updated.

Since typing is a lot of effort, also included is a function called "new", which is a wrapper for GenerateFunctionMFile(true), so all you need to do to create a new file with documentation is type new, and the function name. Easy!

Note: You'll probably want to play with the template of the created m-file to suit your own needs. (At the very least, you'll want to change the copyright line to that of your own company.)

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Automatic template for new functions

MATLAB release MATLAB 7.10 (2010a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
13 Apr 2010 David Legland

nice tool, but I personnaly prefere tedit (#8532), that I found easier to configure and to use.

Please login to add a comment or rating.
Updates
12 Apr 2010

Acknowledged inspiration.

Tag Activity for this File
Tag Applied By Date/Time
utility Richie Cotton 12 Apr 2010 11:03:08
template Richie Cotton 12 Apr 2010 11:03:08

Contact us at files@mathworks.com