Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
GUI changes size in different Matlab versions

Subject: GUI changes size in different Matlab versions

From: Scott

Date: 6 Mar, 2011 14:36:07

Message: 1 of 8

I created a GUI in Matlab 2009a on Windows Vista. I've recently upgraded to Win7 and Matlab 2010b. When I run the same GUI in the new version, the GUI is much larger, almost 25% larger, even though the screen resolution has remained the same. The buttons all seem to have gotten larger. I've uploaded a jpg to photobucket:
http://i240.photobucket.com/albums/ff30/designbyalgorithm/GUIs.jpg
Is there some way to preserve the original size in the new version?

Subject: GUI changes size in different Matlab versions

From: Bruno Luong

Date: 6 Mar, 2011 15:43:07

Message: 2 of 8

"Scott" wrote in message <il064n$hfb$1@fred.mathworks.com>...
> I created a GUI in Matlab 2009a on Windows Vista. I've recently upgraded to Win7 and Matlab 2010b. When I run the same GUI in the new version, the GUI is much larger, almost 25% larger, even though the screen resolution has remained the same. The buttons all seem to have gotten larger. I've uploaded a jpg to photobucket:
> http://i240.photobucket.com/albums/ff30/designbyalgorithm/GUIs.jpg
> Is there some way to preserve the original size in the new version?

What is the unit of your figure?
What is the unit of your buttons?
What is the font size you are using?
What is the DPI setup of your screen?

Bruno

Subject: GUI changes size in different Matlab versions

From: Scott

Date: 6 Mar, 2011 17:03:36

Message: 3 of 8

> What is the unit of your figure?
characters

> What is the unit of your buttons?
characters

> What is the font size you are using?
8

> What is the DPI setup of your screen?
>> get(0,'ScreenPixelsPerInch')
ans =
    96

Subject: GUI changes size in different Matlab versions

From: Think blue, count two.

Date: 6 Mar, 2011 17:10:30

Message: 4 of 8

On 06/03/11 8:36 AM, Scott wrote:
> I created a GUI in Matlab 2009a on Windows Vista. I've recently upgraded
> to Win7 and Matlab 2010b. When I run the same GUI in the new version,
> the GUI is much larger, almost 25% larger, even though the screen
> resolution has remained the same. The buttons all seem to have gotten
> larger. I've uploaded a jpg to photobucket:
> http://i240.photobucket.com/albums/ff30/designbyalgorithm/GUIs.jpg
> Is there some way to preserve the original size in the new version?

Interesting. Is this a GUIDE GUI? Could you post a segment of the code
that determines the positions and sizes of the controls? Also, could you
check that your font size is still what you expect ?

Subject: GUI changes size in different Matlab versions

From: Scott

Date: 6 Mar, 2011 17:21:20

Message: 5 of 8

I think I found the problem. On the machine where the GUIs are large, the ScreenPixelsPerInch shows up as 116 instead of 96. Don't know why, since both machines are identical with identical screens. Anyway, I did:

set(0,'ScreenPixelsPerInch',96)

And now the GUI is the right size.

BTW, Matlab help says:

"ScreenPixelsPerInch

    Display resolution

    DPI setting for your display. This property contains the setting of your display resolution specified in your system preferences."

but I don't see any place in the Matlab preferences where this value is set. Strange.

Subject: GUI changes size in different Matlab versions

From: Scott

Date: 6 Mar, 2011 17:29:05

Message: 6 of 8

Just for grins, I set the pixels per inch to 20 and ran the GUI. I got a tiny one inch tall dialog and I could hardly even see the buttons! :)

Subject: GUI changes size in different Matlab versions

From: Bruno Luong

Date: 6 Mar, 2011 17:39:04

Message: 7 of 8

"Scott" wrote in message <il0fqg$43v$1@fred.mathworks.com>...
> I think I found the problem. On the machine where the GUIs are large, the ScreenPixelsPerInch shows up as 116 instead of 96. Don't know why, since both machines are identical with identical screens. Anyway, I did:
>
> set(0,'ScreenPixelsPerInch',96)
>
> And now the GUI is the right size.
>
> BTW, Matlab help says:
>
> "ScreenPixelsPerInch
>
> Display resolution
>
> DPI setting for your display. This property contains the setting of your display resolution specified in your system preferences."
>
> but I don't see any place in the Matlab preferences where this value is set. Strange.

The DPI is system setup not Matlab. It's usualy the cause of big headache to design a GUI layout that work for different machines. Usualy set to NORMALIZED unit work best.

Bruno

Subject: GUI changes size in different Matlab versions

From: Nasser M. Abbasi

Date: 19 Mar, 2011 21:16:20

Message: 8 of 8

On 3/6/2011 9:39 AM, Bruno Luong wrote:

> "Scott" wrote in message<il0fqg$43v$1@fred.mathworks.com>...
>> I think I found the problem. On the machine where the GUIs are large, the ScreenPixelsPerInch
> shows up as 116 instead of 96. Don't know why, since both machines are identical with identical
> screens. Anyway, I did:
>>
>> set(0,'ScreenPixelsPerInch',96)
>>
>> And now the GUI is the right size.
>>
>> BTW, Matlab help says:
>>
>> "ScreenPixelsPerInch
>>
>> Display resolution
>>
>> DPI setting for your display. This property contains the setting of your display resolution specified in your system preferences."
>>
>> but I don't see any place in the Matlab preferences where this value is set. Strange.
>


> The DPI is system setup not Matlab. It's usualy the cause of big headache to design a
> GUI layout that work for different machines. Usualy set to NORMALIZED unit work best.
>
> Bruno


Should then one type

set(0,'ScreenPixelsPerInch',96)

before starting their GUI to make sure it always come up the same size
(even if one had used 'units' 'normalized') ?

Just to make sure the GUI comes up the same relative size, on different
physical screen sizes?

I've also had the same problem with GUI coming up different size
when I changed computers or monitors. I now use normalized units
all the time. I hope that is all what is needed.

--Nasser

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us