Create help that displays in the help window for a variable that loads in the workspace.

1 次查看(过去 30 天)
Hi,
Im working with a quite large number of arrays and variables in the workspace and I would like to know if it is possible to write a help file for them.
I know I can do it for a self created function at the beginning, but I am trying to do so for the variables so when I define :
B_friends= [4 6 5 2 6 8 9 12 56]
And I click on B_friends later on and on Help I can see what B_friends ( Birthday friends) means. This example is stupid but I am dealing with a lot of different names and I would like to avoid going to the begging each time to the place where I defined it (that might be another file).
Thanks in advance

采纳的回答

John D'Errico
John D'Errico 2017-10-21
There is no facility to provide user written help on a variable, or mouseover capability to do the same.
Perhaps an option is to use structs. Include in each struct a help field, as well as a field that actually contains the information in the variable. Or, you could write your own class to do the same. In any case, these variables will be more cumbersome to work with and use. I seriously doubt it is worth the effort.
As Rik suggested, a good option is to learn to use descriptive variable names. Don't name your variables a,b,c, etc. There is no charge for longer variable names, and a good descriptive name is well worth the effort, in terms of debugging and just ease of use. Tab completion will make things easy.

更多回答(1 个)

Rik
Rik 2017-10-21
As far as I know, it is impossible to have a mouse-over with more information for variables. The only solution would be to have clear names. Extremely long names can be a nuisance, but there tab-completion should come to the rescue.

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by