Create help text for subfunctions

4 次查看(过去 30 天)
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 个评论
Daniel Shub
Daniel Shub 2012-5-4
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.

请先登录,再进行评论。

采纳的回答

Morten Lindhardt Madsen
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.

更多回答(1 个)

Jan
Jan 2012-5-4
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.

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by