MATLAB: How to close an uialert programmatically

uialert uitest

I'm developping some tests with the matlab.uitest framework. Everything is fine until my app generates an uialert, which is expected behavior.
The problem is, once uialert pop-up is there, I can't do any more gesture (choose, press, drag…). If I unlock the app and close the uialert manually (with matlab.uitest.unlock(fig)), then everything is fine again.
So, do you know any way to close an uialert programmatically ?

Best Answer

The uialert window cannot be programmatically closed, at least not in r2020a. You can, however, make the uialert non-modal which will allow you to interact with the base figure (app) while the uialert still exists.
uialert(uifig, 'message', 'title', 'Modal', false)
Alternatively, you could use a msgbox which outputs a handle that you can use to delete at any time but this will not be automatically centered on the app like the uialert panel does.
Related Question