### Tags: creensize, following, followsi, input, matlab, monitorsize, obtain, obtaining, programming, reading, screen, size, user

# Obtaining Correct Screen Size (get(0,'screensize'))

On Programmer » Matlab

4,583 words with 2 Comments; publish: Wed, 30 Apr 2008 16:57:00 GMT; (200125.00, « »)

Thanks for reading this post.

The problem is as follows:

I need to obtain the correct monitorsize without user input.

I do the following on a 19" monitor,

set(0,'units','inches');

get(0,'screensize')

and get

ans =

0 0 12 9

That means, Screensize =sqrt(12^2+9^2)=15!! As I said, I have a 19"

monitor.

I contacted matlab support and they say the results can be

inaccurate.

All the softwares we use, how are they able to determine the correct

screen size? We have seen that they automatically adapt themselves to

12/15/17/19" monitors. This means that there should be some way

(dos/unix commands) to get the exact screen size.

FYI:

<[url]http://www.mathworks.com/support/solutions/data/1-18VJN.html?solution=1-18VJN[/ur

l]>

*http://matlab.questionfor.info/q_matlab_42909.html*

All Comments

Leave a comment...

- 2 Comments
- Y. Mehta wrote:
>

> Thanks for reading this post.

> The problem is as follows:

> I need to obtain the correct monitorsize without user input.

> I do the following on a 19" monitor,

> set(0,'units','inches');

> get(0,'screensize')

> and get

> ans =

> 0 0 12 9

> That means, Screensize =sqrt(12^2+9^2)=15!! As I said, I have a 19"

> monitor.

> I contacted matlab support and they say the results can be

> inaccurate.

> All the softwares we use, how are they able to determine the

> correct

> screen size? We have seen that they automatically adapt themselves

> to

> 12/15/17/19" monitors. This means that there should be some way

> (dos/unix commands) to get the exact screen size.

> FYI:

> <[url]http://www.mathworks.com/support/solutions/data/1-18VJN.html?solution=1-18VJN[/

url]>

>

I know not what you plan on doing with this code, but I'll weigh in

anyhow. Seems to me it would be easier to deal with pixel

dimensions. It seems that that would make whatever your end-goal is

somewhat hardware independant.

If you truly need monitor dimensions in inches, then it would seem

that your hardware (and driver) should be reporting this value back

to the OS, which, I'm guessing, passes these values along to MatLab.

The place to start looking, I think, would be at the monitor driver.

Is the correct driver installed for the monitor(s) you are using?

Is/are the monitor(s) 'Plug and Play'? (Or should that be Plug and

Pray?)

I'm not convinced this is a ML problem. Good luck, and hth.

Ted

#1; Wed, 30 Apr 2008 16:58:00 GMT

- Y. Mehta wrote:
- "Y. Mehta" <dndn_don.matlab.questionfor.info.yahoo.com> wrote in message
news:ef0057b.-1.matlab.questionfor.info.webx.raydaftYaTP...

> Thanks for reading this post.

> The problem is as follows:

> I need to obtain the correct monitorsize without user input.

> I do the following on a 19" monitor,

> set(0,'units','inches');

> get(0,'screensize')

> and get

> ans =

> 0 0 12 9

> That means, Screensize =sqrt(12^2+9^2)=15!! As I said, I have a 19"

> monitor.

> I contacted matlab support and they say the results can be

> inaccurate.

>

To elaborate here... If you have the screen resolution set wrong on your

computer, then MATLAB is going to use that wrong number. MATLAB

can't do this accurately unless you've set your system up accurately.

MATLAB is just using the numbers your system is giving it.

The details of setting the screen resolution vary with the type of operating

system. Just as an example, if you're running Windows XP it might go like

this. You'd go to the "Display Properties" control panel, choose the

"Settings"

tab, press the "Advanced" button, and choose the "Custom setting..." choice

on the "DPI setting" drop down. This will display a ruler on the screen.

Hold

a real ruler up to it. Click on the ruler on the screen and drag it until it

matches

the real one. After you've done this, restart MATLAB and call

get(0,'ScreenPixelsPerInch'). You should now get an accurate number.

As I said, the details of how you do this can vary a lot for various

systems.

You'll need to research exactly how to do this for your system.

-MPG-

#2; Wed, 30 Apr 2008 16:59:00 GMT

- "Y. Mehta" <dndn_don.matlab.questionfor.info.yahoo.com> wrote in message