MATLAB: Uistack figure simulator top

uistack

Hello,
software ( main figure) in gui has name Simulator. If I have opened two and more figures, and I use
set(0,'CurrentFigure',findobj('type','figure','name','Simulator'))
f=gcf
uistack(f, 'top')
than Simulator is on the top. But if there is opened only Simulator, and I use above code, than appears main Matlba Window on the top.
How can I do, that Simulator will be always on the top?
Thank you

Best Answer

According to the documentation, this should be sufficient already:
FigH = findobj(allchild(0), 'flat', 'name', 'Simulator');
figure(FigH);