Create help text for subfunctions

2 views (last 30 days)
Hi
I have a script with a main function and some subfunctions under it (all in same script). I need to write help text for the subfunctions, so that the user can write help (the name of the subfunction) and then my help text will appear. Any ideas?
- Morten
  1 Comment
Daniel Shub
Daniel Shub on 4 May 2012
You have a script with a functions in it? I am pretty sure that is not supported. Assuming you have an m file with a function called myfunc and a subfunction called mysubfunc, then my subfunc cannot be called by the user so giving a help sections doesn't seem to make sense. Additionally, this could cause problems for searching for overloaded functions.

Sign in to comment.

Accepted Answer

Morten Lindhardt Madsen
Morten Lindhardt Madsen on 4 May 2012
Well i just found out how to do it:
help functionname>subfunctionname
It works perfectly. And it is very usefull when you get an error from one of the subfunctions. Then you can call the help text that tells you what the function does. It provides faster overview of troubleshooting.

More Answers (1)

Jan
Jan on 4 May 2012
The help command looks for the help section of the main function only. Therefore you cannot define helpsections for the subfunctions, which can be found by help SubFunctionName.
As Daniel has explained already, this would not be useful at all, because the subfunction cannot be reached externally.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!