MATLAB Community

MATLAB, community & more

Your Table of Contents

MATLAB provides a few command line tools to figure out what functions you have available in a directory. There’s dir, what, and of course, help. Using the help function with a directory (or toolbox) name will list the available functions along with their H1 lines.

help filterdesign

By default, MATLAB displays a flat list of files, but if you’d like to control what information is actually displayed, you need to create a Contents.m file. We use Contents.m in toolbox directories to group together related functions, display copyright and version information, and exclude listing helper functions not meant to be called directly.

To create a Contents.m, you must create a new MATLAB-File named “Contents.m”. This file should have all your contents information in a single comments block at the top of the file. This file should not contain any executable code. The text of the comment block becomes the help information. Each directory on your search path can have a Contents.m.

To assist in creating a standard format Contents.m, you can use the Contents Directory Report.

contents report

The contents report will look at the MATLAB files in a directory and build a Contents.m file using the filenames and H1 lines. If there already is a Contents.m in a directory. The contents report will identify discrepancies in the file listings or in the H1 lines.

—-Edit 1/26/09 … Loren has just reminded me that that the contents file is Contents.m (with a capital “C”) and not lowercase as I originally mentioned.

|
  • print

评论

要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。