detailed description of handle properties from command line

1 view (last 30 days)
I'm wondering if someone here can help me out with an infrequent annoyance I encounter with handle properties in MATLAB. I am well aware that the properties associated with a handle object can be queried with the get(handle) command. However, where I begin to stumble is when I need to know the details associated with a particular property. As an example, take the figure handle property 'Position'. Not knowing much about it's behavior, by it's name, 'Position' sounds like it controls what I want so what I want to do is execute a command like:
help(get(gcf,'Position'))
to get the details of the 'Position' property. I know that I can sift through the html documentation to find the details but that is really inefficient and time consuming whereas command line help is much more efficient.
Is there a command line shortcut to report the details of an arbitrary property without having to sift through the html documentation to get the information I seek?

Accepted Answer

Oleg Komarov
Oleg Komarov on 20 Aug 2011
inspect(gcf)
Then right click on Position > help.
EDIT 2
You can write a function to open the html at the description of the property (using the internal calls of inspector):
function helphg(h,propertyname)
classname = [];
if ishandle(h)
h = handle(h);
if ~isobject(h)
hCls = classhandle(h);
hPk = get(hCls,'Package');
classname = [get(hPk,'Name'), '.',get(hCls,'Name')];
else
classname = class(h);
end
end
helpview(['mapkey:',classname],propertyname,'CSHelpWindow');
Then simply use it as:
helphg(gcf,'Position')
EDIT 3
A question for Jan, Walter and others:
why figure has no properties:
properties(figure)
  3 Comments

Sign in to comment.

More Answers (2)

Walter Roberson
Walter Roberson on 20 Aug 2011
Sorry, No, there is not.
You can use
set(gcf, 'Position') %notice this is SET
which will give you a (very) brief description of what must be paired with a 'Position' option, but it is only useful perhaps 1/3 of the time.
  1 Comment
Christopher Beaudoin
Christopher Beaudoin on 20 Aug 2011
Yes, this isn't particularly useful - at least not for the 'Position' property. It seems that if someone could just simply replace the useless text provided when this command is executed with the text that is reported in the html document for the property, this would be 100% more useful command.

Sign in to comment.


Jan
Jan on 20 Aug 2011
I simply read doc figure completely to learn the meaning and format of the properties. For learning a language it is usually necessary to drill the vocabulary.
  2 Comments
Christopher Beaudoin
Christopher Beaudoin on 20 Aug 2011
Well, the problem is that do a lot more than write MATLAB code all day. I can't devote every property/function to memory which is why I rely on the command line help so frequently. Having to go through the doc everytime I need to refresh my memory on a property is really inefficient!
Oleg Komarov
Oleg Komarov on 20 Aug 2011
I agree with Cristopher this time, I keep forgetting stuff and unfortunately you cannot use the same syntax as:
help containers.Map.KeyType
with hg.figure.Position unless the .m helper is modified by including all helps of the underlying properties.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!