When multiple monitors are connected to my computer, I can detect them, and draw figures to them by setting the position according to the values obtained from
get(0, 'MonitorPositions')
However, when I disconnect a monitor while MATLAB is running, this property is not updated. I use distFig to handle the positioning of the figures, but since this property is not updated, sometimes the figures are drawn at the pixel locations that lay outside my screen (i.e. drawing on my disconnected monitor).
Restarting MATLAB solves the issue, but is there a way to re-detect the number of monitors connected?