# SetResolution doesnt recognise my 'NearestResolution' width/height dimensions on retina display

**URL:** https://psychtoolbox.discourse.group/t/setresolution-doesnt-recognise-my-nearestresolution-width-height-dimensions-on-retina-display/3294
**Category:** Programming Help
**Created:** [July 15, 2020, 12:52pm UTC](https://psychtoolbox.discourse.group/t/setresolution-doesnt-recognise-my-nearestresolution-width-height-dimensions-on-retina-display/3294 "2020-07-15T12:52:55Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![samswebb96](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@samswebb96](https://psychtoolbox.discourse.group/u/samswebb96)
#### Post date: [July 15, 2020, 12:52pm UTC](https://psychtoolbox.discourse.group/t/setresolution-doesnt-recognise-my-nearestresolution-width-height-dimensions-on-retina-display/3294/1 "2020-07-15T12:52:55Z")

</div>

Hi all,

I am having issues setting the resolution of my mac’s screen, whereas the resolution changes work with my extended screen.

**My software/hardware:**

- I am working in Matlab (9.7.0.1319299 (R2019b) Update 5)
- Psychtoolbox-3 ('3.0.16 - Flavor: beta - Corresponds to SVN Revision 10582)
- MacBook pro (MacOS Mojave,13inch 2560 x1600, Intel Iris Plus Graphics 640 1536 MB)
- Extending to a Philips monitor (27inch, 1920 x 1080 ,Intel Iris Plus Graphics 640 1536 MB graphics)

**My reproducible code:**  
Not sure if the error will reproduce on other systems:  
The following works no matter the value of whichScreen

```auto
whichScreen = max(Screen('Screens'));
originalRes = Screen('Resolution',whichScreen); %get the original screen resolution
desiredRes = [1920,1080,NaN]; %the desired width and height in resolution
res= NearestResolution(whichScreen,desiredRes); %find the nearest screen resolution to the desired resolution

```

The following line ONLY works on my extended screen where the value of whichScreen is 1 not 0.

```auto
SetResolution(whichScreen, res); %this alters the resolution of the screen to better support cross screen adaption

```

**Error message:**

> Error in function Resolution: Usage error  
> Invalid or mutually incompatible video settings requested!  
> One or more of the values are invalid or unsupported by your display device.  
> Error using Screen  
> Usage:  
> oldResolution=Screen(‘Resolution’, screenNumber [, newwidth][, newheight][, newHz][, newPixelSize][, specialMode]);  
> Error in SetResolution (line 124)  
> oldRes = Screen(‘Resolution’, screenNumber, nres.width, nres.height, nres.hz, nres.pixelSize);

Bear in mind I have used ‘Screen(‘Resolutions’,0)’ to check the resolutions of my mac screen and the width/height is fine, but as the Hz is 0 I think this is where the issue lies but i can’t fix.

---

<div class="post-metadata">

### Author: ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)
#### Post date: [July 18, 2020, 5:22pm UTC](https://psychtoolbox.discourse.group/t/setresolution-doesnt-recognise-my-nearestresolution-width-height-dimensions-on-retina-display/3294/2 "2020-07-18T17:22:10Z")

</div>

Setting any resolution than the native one is pointless on a Retina display, as Apples trainwrecks would reward such an act with broken visual timing. PTB will always choose the native Retina resolution, no matter what you try, so this is basically intentional.

You could use the PTB panelfitter (cfe. PanelFitterDemo) to draw and display stimuli at a smaller resolution than the native (or scaled) Retina resolution. It would rescale stimuli from wanted resolution/size to full display size if used correctly.

In general, even on external displays - unless they are CRTs, the Panelfitter approach is better, as digital flat panels or projectors may have degraded display timing if not used at their native resolution and refresh rate.

So changing resolution is mostly only useful nowadays on CRT monitors.
