MATLAB: How to control the stacking order of objects in appdesigner

appdesigneruistack

How can I control the stacking order of objects in appdesigner? It seems to be determined by the order in which the panels or axes are created. What if I want an object created later to slide underneath earlier objects?

Best Answer

You can control the order of the 'Children' of a graphics object directly:
fig = uifigure;
panel1 = uipanel(fig, 'BackgroundColor', 'b');
panel2 = uipanel(fig, 'BackgroundColor', 'r');
fig.Children = flip(fig.Children)