Correct use of get(H,'Property Name')
2 次查看(过去 30 天)
显示 更早的评论
When I use get(H,'Property Name') and insert H manually, it works fine, but as soon as I try to define a variable H and insert it afterwards, get does not work any longer, no matter which data type i choose for H. How can I solve this problem?
1 个评论
Stephen23
2017-1-29
"..I try to define a variable H and insert it afterwards.."
What would be the desired effect? For example:
H = 1.2;
get(H,'Children')
What should this do???
回答(2 个)
Star Strider
2017-1-29
In this context, ‘H’ is a handle, and the output of the creation of a specific object (for example figure, text, line etc.). You cannot just assign ‘H’ as an arbitrary variable and then use it with the get or set functions, because it has no meaning. Unless ‘H’ refers to an object with properties, using it with set or get is meaningless.
0 个评论
Image Analyst
2017-1-29
Not sure what you're doing to define H but if you did it properly it should work. For example
H = handles.slider1; % Get the handle to your slider control.
% Now get the slider value:
sliderValue = get(H, 'Value'); % or sliderValue = H.Value in new MATLAB versions.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Debugging and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!