I found this code which works very well, for those who didn't find it :
ScreenPixelsPerInch = java.awt.Toolkit.getDefaultToolkit().getScreenResolution()
ScreenDevices = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
MainScreen = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getScreen()+1;
MainBounds = ScreenDevices(MainScreen).getDefaultConfiguration().getBounds();
MonitorPositions = zeros(numel(ScreenDevices),4);
First of all, I'm susprised to find native support for Java in Matlab, which opens up all kinds of interesting possibilities.
Second of all, even if I get the true physiical screen resolution from Java, it still does not solve my problem? Which is, how I force a figure or an axis to a "real" physical size? If I try to set a figure to be 800x600, for example :
set(FigureH, 'color', 'w', 'MenuBar', 'none', 'Position', [500 200 800 600]);
In actuality, the figure size is "twice" that much or 1600x1200.
May not seem like a problem to you but my algorithms are based on the 'sizes' I have access to from regular Matlab code, such as "MouseMove Fcn" callback :
function mouseMove (source, eventdata)
ax1 = gca; % ancestor(source, 'axes');
% CurrentPoint is relative to ax.InnerPosition
CP = round(get (ax1, 'CurrentPoint'));
x = CP(1,1);
y = CP(1,2);
There is no way I could "trust" the CurrentPoint vector information if the code is ran on a 4K monitor?
Is there a way I can call for all "pixel units" to be on 1920 x 1080 scale?
Even if the interface ends up looking "tiny" on a 4K monitor?
Sorry for these kinds of "mundane" questions which are not very scientific-related...