detailed description of handle properties from command line
1 view (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
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
More Answers (2)
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.
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
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.
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!