Matlab Gui Compatibility - Different Aspects Between Linux and MacOS

I have a compatibility issue between Linux and MacOS with Matlab Gui. The graphical interface is developed under Linux Debian 7.0. Here's an aspect on this platform:

enter image description here

Now I am executing the .m file on MacOS, and here is the result:

enter image description here

As you can see, the panel (the field where there are 3 disks in the first figure (sorry, 3 disks do not appear in the second)) and, more globally, the number on MacOS 10.9.5 is stretched horizontally, i.e. the window is wider than tall.

I tried changing Units (tried with characters, normalized, pixels), but does nothing.

it doesn’t bother me to have a different font for “editing” boxes and buttons, but I would like to have the same aspect ratio for both OSs for the panel, i.e. have a square panel, for example, under Linux Matlab.

If someone can help me, it will be fine

thanks

+5
source share
1 answer

The trick is not only to set 'Units' to 'pixels' on your gfx objects, but also use these units to set the position. :-)

In the following code snippet, ha is the descriptor of the axes, and hf is the descriptor of the attached figure. You can force a specific pixel size for the axes:

 set(hf, 'Units', 'pixels'); %// Not necessary, but better not mix units set(ha, 'Units', 'pixels'); pos = get(ha, 'position'); set(ha, [pos(1:2), 400, 400]); %// 400x400 pixels 

You can apply this to the position of any of the graphic objects in the figure.

+1
source

All Articles