Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MATLAB: Invisible figure handles behave differently on Windows and Linux?

I always thought that, in MATLAB, a graphic handle X whose property HandleVisibility is set to anything else than on will not show up when using findobj(h) or get(h, 'Children') with h being the parent of X. However, this seems to be true only under Windows and not under Linux. I am using MATLAB R2011b both on Debian 6.0.6 (squeeze) and Windows 7. If I run the following code under Windows:

figure;plot(randn(1,1000));
h = get(gcf, 'Children'); 

Then I get a single handle in h, which corresponds to the axes that contain my random plot. This is what I would expect. However, if I run exactly the same code in Linux, h contains an array of 10 handles. Indeed most of those handles are just UI elements, whose HandleVisibility property is set to off. For instance:

get(h(end), 'Type')   % returns: 'uitoolbar'
get(h(end), 'HandleVisibility') % returns 'off'

Is there a reason for this apparently inconsistent behavior? Can this be reproduced by others? In case it could be relevant, the Debian server that I am using runs Sun JAVA 1.6.0_26, which is not the default on Debian (openJDK).

like image 691
German Gomez-Herrero Avatar asked Dec 05 '25 16:12

German Gomez-Herrero


1 Answers

I was unable to reproduce on either r2011a or r2012b, with Sun JAVA.

One workaround might be to filter based on visibility:

visibleChildren = findobj(get(h,'children'),'HandleVisibility','on')

Sounds like something specific to your install.

like image 117
supyo Avatar answered Dec 07 '25 15:12

supyo