MATLAB Community

MATLAB, community & more

Why the Help Report No Longer Lists Subfunctions

Over the past few releases we have been working to eliminate code in the desktop that duplicates or approximates the logic in the MATLAB language. The goal of this project is to reduce bugs and to make sure there is a single “truth” in regards to what we tell you about your code. Older versions of the Help Report relied on performing expression searches to identify various parts of a file’s help. As of MATLAB R2010a, the Help Report now uses the same internal APIs as the MATLAB help function to extract help information from the files in a directory. This means that the report accurately reflects what you would see when typing “help functionname” or “doc functionname“.

Changing the logic had an interesting consequence: the Help Report no longer lists subfunctions. Here is an example from MATLAB R2009b:

Help Report R2009b
Help report with subfunction in MATLAB R2009b

compare that to MATLAB R2010a:

Help Report R2010a
Help report without subfunctions in MATLAB R2010a

The reason for this change is that help system does not recognize subfunctions because they are not visible outside the parent function. In a sense, there is no valid help for them since formal help is meant for users of your public API. In fact, many of the functions that we supply that are not meant to be used by customers, and do not have help, even if they are well commented. Nonetheless, it is a good practice to comment and document the subfunctions in a file; the lack of language support for subfunction help should not be used as an excuse for lack of documentation.

|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.