3.4

3.4 | 5 ratings Rate this file 120 downloads (last 30 days) File Size: 3.1 KB File ID: #20164

ftoc (v1.2)

by Kenneth Eaton

 

03 Jun 2008 (Updated 19 May 2009)

Code covered by BSD License  

Creates a table of contents of functions contained in an m-file

Download Now | Watch this File

File Information
Description

Since some of the m-files I work with are very large, and contain many nested functions and subfunctions, I find it helpful to keep a short and simple table of contents in the top comment block that tells me which functions are in the m-file, their line numbers, and how they are nested. I wrote FTOC to generate this function table of contents automatically. This was inspired by a posting by Yair Altman on the mathworks newsgroup where he described how to use the undocumented function MLINTMEX. If you're interested in getting even greater detail about m-file contents, you should check out the postings by Urs Schwarz acknowledged below.

Here's how FTOC is used:

STR = FTOC(FILE) returns a character array table of contents STR for all nested functions and subfunctions within the m-file FILE (built-in functions are not displayed). The line numbers of each function are included, and the indentation of the function names indicates the nesting order. FILE should be an m-file name. If FILE is not found, or there are no subfunctions or nested functions, STR will be an empty string.

STR = FTOC(FILE,'insert') will return a character array table of contents STR formatted for the purpose of inserting it into the header comment block of the m-file FILE. Each line begins with the character '%' and the line numbers are adjusted to account for the fact that STR will be inserted somewhere within the top comment block of FILE. (NOTE: you will want to first remove any old table of contents from the comment block before pasting the new one in, to make sure the line numbers are adjusted correctly.)

(See function help for examples)

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
farg: a pedestrian M-file parser showing all used functions' syntax, fdep: a pedestrian function dependencies finder

MATLAB release MATLAB 7.1.0 (R14SP3)
Zip File Content  
Other Files ftoc.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (12)
04 Jun 2008 Urs (us) Schwarz

good...
you also may want to look at FARG, available here

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=15924&objectType=FILE

or FDEP, available here

http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=17291&objectType=FILE

us

04 Jun 2008 Ken Eaton

I've submitted a slightly updated version to remove some mlint messages. The help description was also not formatting properly (no indents appeared, so you have to look at the function header for correct examples).

04 Jun 2008 Ken Eaton

Thanks for the heads up, us. I don't know how I managed to miss FARG when I was looking around to see if anything like this had been done. It looks like a much more beefed-up and detailed version of what I was doing here... I'll have to check it out =).

Ken

06 Jun 2008 fex observer

The submissions mentioned by the first reviewer do an excellent job and are clearly superior to your program.

06 Jun 2008 Ken Eaton

Is there some reason someone is downloading hundreds of copies of this?

07 Jun 2008 m p

Program don’t show this, don’t show clssification. Future versions will show classification: You=Infinite==Infinite|or|Circle*NaN...

09 Jun 2008 Ken Eaton

Is that comment supposed to make sense?... because it doesn't.

10 Jun 2008 A N

Wording and initials suggest the poor poor rating was written by the infamous file exchange author 'marco', either by accident or in revenge. So far I thought DNFTT, but if it's true he now starts to mess up the rating system, I think there should be a way to block him and to annul his rating.

29 Oct 2008 M P

mp of 7 jun 2008 am not I, but will be this the true???? to live will be to know

30 Oct 2008 John D'Errico  
30 Oct 2008 John D'Errico

While I cannot force the trash ratings by Marco to be removed, this is far better than his rating indicates. The help is quite good. This will be a useful utility if you work on large software projects in MATLAB.

31 Oct 2008 Tim Davis  
Please login to add a comment or rating.
Updates
06 Jun 2008

Small fixes to reduce mlint messages.

28 Oct 2008

A couple minor changes in the file, an updated description, and a couple acknowledgments added.

19 May 2009

Fixed description and acknowledgements

Tag Activity for this File
Tag Applied By Date/Time
files Kenneth Eaton 22 Oct 2008 10:04:42
mfile Kenneth Eaton 31 Oct 2008 13:37:10
table of contents Kenneth Eaton 31 Oct 2008 13:37:19
utilities Kenneth Eaton 31 Oct 2008 13:37:23
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com