Create MATLAB header
Language: Python
Last modified: 15 August 2006
The first few commented lines of a MATLAB function are used as help documentation for the function. This script makes it easy to generate a consistent header for your functions and is most useful when run from within a text editor, such as Vim or BBEdit.
Vim setup
Add the following lines to your vimrc
file where ,mh
' - comma
then m
then h
.
" ,mh apply matlab header nmap ,mh :.!/MatlabHeader.py vmap ,mh ! /MatlabHeader.py ### BBEdit or TextWrangler setup The script or an alias to the script should be installed in the Unix Filters
directory - see the manual for the location of this directory. Once installed, you select the function declaration and run the script. ### Sample input and output When run on the following function declaration:function [out1,out2] = testfunction(in1,in2)The script produces the following header:%testfunction % % % % -Usage- % [out1,out2] = testfunction(in1,in2) % % -Inputs- % in1 % in2 % % -Outputs- % out1 % out2 % % Last Modified: 01/26/2009You can customize the header by editing the template at the top of the script.