File Exchange

image thumbnail

InsertHeader

version 1.2 (3.79 KB) by

Inserts a user defined header in the m file currently open in editor

1 Download

Updated

View License

% InsertHeader Adds a template to the top of current file in editor for documentation.
% InsertHeader('filename')

% Example
% InsertHeader('InsertHeader') added the current header information to this
% file. NOTE: THIS CANNOT BE UNDONE! THE FIRST TIME YOU USE THIS, PLEASE
% HAVE A BACK UP COPY OF THE FILE IN CASE IT MAKES A MISTAKE.
% Custom defined headers can be created in the subfunction defined at
% the end of the file. I wish to express thanks to the authors of tedit.m and
% newfcn.m which helped me to create this routine.
% See also: tedit, newfcn

The manner in which I use it is to define a shortcut with the command InsertHeader(). That way when I click the shortcut my header is automatically inserted into whichever file is on top.

Note: If you use keyword expansion with your source control software, it will replace the strings in your template, if you check this file in... so plan on correcting the text before you use it.

This function does perform calls to Java commands which are not part of the normal documentation.

Comments and Ratings (5)

K E

K E (view profile)

Dan - Works great even in R2012b! Thanks for the update.

Dan K

Dan K (view profile)

KE,
 I've updated the code to work again with R2011b. Let me know if there are any issues.
Dan

K E

K E (view profile)

Very useful function, but has stopped working when I switched to R2011a. Generates some java errors.

Carlos Adrian Vargas Aguilera

This is a nice function DAN. Why don't you extract thos little but useful (to me :)) subfunction you use like the one to look for the current file, others to save the file, toget the list of the opened files, etc?

Carlos

Updates

1.2

2011-11-09: Updated to be compatible with versions of Matlab after 2010b

MATLAB Release
MATLAB 7.13 (R2011b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video