# Matlab Crashes when I run the program

**URL:** <https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707>\
**Category:** Programming Help\
**Created:** [February 26, 2021, 4:24pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707 "2021-02-26T16:24:09Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![KeerthanaReddy](https://avatars.discourse-cdn.com/v4/letter/k/f07891/32.png) [@KeerthanaReddy](https://psychtoolbox.discourse.group/u/KeerthanaReddy)\
**Post date:** [February 26, 2021, 4:24pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707/1 "2021-02-26T16:24:09Z")

</div>

Priority support ID: 6FUX997E-2021226102159:7484835513d109f3564a0758d3a48ddcbeb7aaed219d42576481e8b314375228

I’m trying to link an extrernal projector to the psychtoolbox on matlab. And everytime I run it, Matlab crashes. The following error is displayed. I’m new to programming so I cannot figure out what is going on. Can you suggest what can be done?

PTB-ERROR: Screen(‘Flip’); beamposition timestamping computed an _impossible stimulus onset value_ of 431633.456681 secs, which would indicate that  
PTB-ERROR: stimulus onset happened _before_ it was actually requested! (Earliest theoretically possible 431633.467674 secs).

PTB-ERROR: Some more diagnostic values (only for experts): rawTimestamp = 431633.470479, scanline = 866  
PTB-ERROR: Some more diagnostic values (only for experts): line\_pre\_swaprequest = 683, line\_post\_swaprequest = 701, time\_post\_swaprequest = 431633.467948  
PTB-ERROR: Some more diagnostic values (only for experts): preflip\_vblcount = 0, preflip\_vbltimestamp = 431633.456801  
PTB-ERROR: Some more diagnostic values (only for experts): postflip\_vblcount = 0, postflip\_vbltimestamp = -1.000000, vbltimestampquery\_retrycount = 0

PTB-ERROR: This error can be due to either of the following causes:  
PTB-ERROR: Very unlikely: Something is broken in your systems beamposition timestamping. I’ve disabled high precision  
PTB-ERROR: timestamping for now. Returned timestamps will be less robust and accurate.

PTB-ERROR: The most likely cause would be that Synchronization of stimulus onset (buffer swap) to the  
PTB-ERROR: vertical blank interval VBL is not working properly, or swap completion signalling to PTB is broken.  
PTB-ERROR: Please run the script PerceptualVBLSyncTest to check this. With non-working sync to VBL, all stimulus timing  
PTB-ERROR: is futile. Also run OSXCompositorIdiocyTest on macOS. Also read ‘help SyncTrouble’ !  
PTB-INFO: Enforcing script abortion and restoring desktop by executing Screen(‘CloseAll’) now!  
PTB-INFO: Please ignore the false error message (INTERNAL PSYCHTOOLBOX ERROR) caused by this…

PTB-INFO: There are still 361 textures, offscreen windows or proxy windows open. Screen(‘CloseAll’) will auto-close them.  
PTB-INFO: This may be fine for studies where you only use a few textures or windows, but a large number of open  
PTB-INFO: textures or offscreen windows can be an indication that you forgot to dispose no longer needed items  
PTB-INFO: via a proper call to Screen(‘Close’, [windowOrTextureIndex]); , e.g., at the end of each trial. These  
PTB-INFO: stale objects linger around and can consume significant memory ressources, causing degraded performance,  
PTB-INFO: timing trouble (if the system has to resort to disk paging) and ultimately out of memory conditions or  
PTB-INFO: crashes. Please check your code. (Screen(‘Close’) is a quick way to release all textures and offscreen windows)

INFO: PTB’s Screen(‘Flip’, 10) command seems to have missed the requested stimulus presentation deadline  
INFO: a total of 17 times out of a total of 197 flips during this session.

INFO: This number is fairly accurate (and indicative of real timing problems in your own code or your system)  
INFO: if you provided requested stimulus onset times with the ‘when’ argument of Screen(‘Flip’, window [, when]);  
INFO: If you called Screen(‘Flip’, window); without the ‘when’ argument, this count is more of a ‘‘mild’’ indicator  
INFO: of timing behaviour than a hard reliable measurement. Large numbers may indicate problems and should at least  
INFO: deserve your closer attention. Cfe. ‘help SyncTrouble’, the FAQ section at [www.psychtoolbox.org](http://www.psychtoolbox.org) and the  
INFO: examples in the PDF presentation in PsychDocumentation/Psychtoolbox3-Slides.pdf for more info and timing tips.

---

<div class="post-metadata">

**Author:** ![dcnieho](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@dcnieho](https://psychtoolbox.discourse.group/u/dcnieho)\
**Post date:** [February 26, 2021, 4:52pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707/2 "2021-02-26T16:52:03Z")

</div>

Please provide more information, see [https://psychtoolbox.discourse.group/t/posting-guidelines/3058](https://psychtoolbox.discourse.group/t/posting-guidelines/3058)

Also, what do you mean by crash? Does the whole matlab close or just the screen that opened? Your log seems to suggest a lot your code ran. Please run some of the demos that come with PTB. Do they work fine?

---

<div class="post-metadata">

**Author:** ![KeerthanaReddy](https://avatars.discourse-cdn.com/v4/letter/k/f07891/32.png) [@KeerthanaReddy](https://psychtoolbox.discourse.group/u/KeerthanaReddy)\
**Post date:** [February 26, 2021, 5:08pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707/3 "2021-02-26T17:08:22Z")

</div>

The whole Code crashes and the screen I’m running it on goes blank. I get a black PTB window. I have force stop MATLAB. Also, Can you send a link to the demos?  
I borrowed this code from github and do not know how this works. Apologies for not having precise questions.

---

<div class="post-metadata">

**Author:** ![dcnieho](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@dcnieho](https://psychtoolbox.discourse.group/u/dcnieho)\
**Post date:** [February 26, 2021, 5:39pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707/4 "2021-02-26T17:39:11Z")

</div>

help PsychDemos in matlab gets you a list of demos, but it seems to be a problem with your own code then.

The post instructions also ask to provide information about operating system, versions of various things and such, please provide that information

---

<div class="post-metadata">

**Author:** ![KeerthanaReddy](https://avatars.discourse-cdn.com/v4/letter/k/f07891/32.png) [@KeerthanaReddy](https://psychtoolbox.discourse.group/u/KeerthanaReddy)\
**Post date:** [February 26, 2021, 5:46pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707/5 "2021-02-26T17:46:59Z")

</div>

MATLAB Version 9.9 (R2020b)  
Simulink Version 10.2 (R2020b)  
DatapixxToolbox Version 0.9, Aug  
Image Acquisition Toolbox Version 6.3 (R2020b)  
Image Processing Toolbox Version 11.2 (R2020b)  
Instrument Control Toolbox Version 4.3 (R2020b)  
Parallel Computing Toolbox Version 7.3 (R2020b)  
Psychtoolbox Version 3.0.17 2 November  
Operating Sytem:Microsoft Windows 10 Enterprise Version 10.0 (Build 19041)  
Java Version: Java 1.8.0\_202-b08 with Oracle Corporation Java HotSpot™ 64-Bit Server VM mixed mode

This is the code I’m trying to run:

> **[computed-axial-lithography/CAL-software-Matlab](https://github.com/computed-axial-lithography/CAL-software-Matlab)**
>
> Software to support volumetric additive manufacturing by tomographic reconstruction (education, research and not-for-profit use)

---

<div class="post-metadata">

**Author:** ![dcnieho](https://avatars.discourse-cdn.com/v4/letter/d/779978/32.png) [@dcnieho](https://psychtoolbox.discourse.group/u/dcnieho)\
**Post date:** [February 26, 2021, 7:13pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707/6 "2021-02-26T19:13:38Z")

</div>

In that case, see if the examples that come with that toolbox work. If you have issues with code you write on top of that toolbox, you should probably contact them for support

---

<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:** [February 26, 2021, 9:10pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707/7 "2021-02-26T21:10:22Z")

</div>

Cool toolbox and application, that! I skimmed their code and they use PTB to project the sequence of lithography images via the projector.

Their use of Psychtoolbox is very basic, and highly suboptimal, it would benefit a lot from a rewrite, to guarantee cross-platform support, instead of being locked to Windows, also to improve what must be shaky presentation timing. I’d assume timing matters for the quality of the computed lithography.

That said, the code is sort of correct and shouldn’t cause hangs by itself. This looks like typical presentation timing trouble caused by some misconfiguration or deficiency of your Windows-10 system, so similar problems should happen with our demos. E.g., what does …

`clear all; Screen('Preference','Verbosity',10); Screen('Preference','VisualDebugLevel',6); PerceptualVBLSyncTest;` show and print as output? Or `VBLSyncTest([],3)`?

What graphics card and other hardware do you have? I assume this is a dual-display setup? These are often problematic on Windows due to system bugs. In principle you could as a first step make sure to follow all advice in `help SyncTrouble` and `help RetinaDisplays`.

E.g., make sure the projector is set as “main display” or “primary output” in the display settings. Make sure you are not using a mixed setup of HiDPI monitor and standard resolution projector (1920x1080, it looks like?).

---

<div class="post-metadata">

**Author:** ![KeerthanaReddy](https://avatars.discourse-cdn.com/v4/letter/k/f07891/32.png) [@KeerthanaReddy](https://psychtoolbox.discourse.group/u/KeerthanaReddy)\
**Post date:** [March 3, 2021, 10:01pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707/8 "2021-03-03T22:01:35Z")

</div>

Hello,

Thankl you, The code  
clear all; Screen(‘Preference’,‘Verbosity’,10); Screen(‘Preference’,‘VisualDebugLevel’,6); PerceptualVBLSyncTest;

Gives a blinking screen on both the monitor and the projector(when it is set as main display)

While I set the projector to main display and run the code on MATLAB,the following is displayed:  
PTB-DEBUG: PsychOSOpenOnscreenWindow: Entering Win32 specific window setup…  
PTB-DEBUG: Checking for DWM desktop compositor support… … DWM available on this Vista (or later) system. Binding controls … …done  
PTB-DEBUG: Dual-display operation on logical screen zero → Switching both screens 1 and 2 into fullscreen mode.  
PTB-DEBUG: Switching display for screen 1 to fullscreen mode with resolution 1680 x 1050 with bpp = 32 @ 60 Hz.  
PTB-DEBUG: Switching display for screen 2 to fullscreen mode with resolution 1920 x 1080 with bpp = 32 @ 59 Hz.  
PTB-DEBUG: PsychOSOpenOnscreenWindow: Window parameters computed, display switch to fullscreen done (if needed). Registering window class…  
PTB-DEBUG: Window enumeration done. Our hostwindow is HWND=0000000000050478, Name: ‘MATLAB R2020b - academic use’

PTB-DEBUG: PsychOSOpenOnscreenWindow: Window class registered - Creating GDI window…  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): WM\_SIZE!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: Created onscreen window has position 0 x 0 and a size of 3840 x 1080.  
PTB-DEBUG: PsychOSOpenOnscreenWindow: Window created - Pixelformat selection…  
PTB-DEBUG: PsychOSOpenOnscreenWindow: ChoosePixelFormat(), SetPixelFormat() done… Creating OpenGL context…  
PTB-DEBUG: PsychOSOpenOnscreenWindow: Context created - Activating and binding context…  
PTB-DEBUG: PsychOSOpenOnscreenWindow: Online - glewInit()…  
PTB-INFO: Using GLEW version 2.1.0 for automatic detection of OpenGL extensions…  
PTB-DEBUG: PsychOSOpenOnscreenWindow: Mastercontext created, activated and bound - Enabling multisampling if needed…  
PTB-DEBUG: Window and master OpenGL context creation finished.  
PTB-DEBUG: Before slaveWindow context sharing: glGetString reports 0000020914383740 pointer…  
PTB-DEBUG: After slaveWindow context sharing: glGetString reports 0000020914383740 pointer…  
PTB-DEBUG: Final low-level window setup: ShowWindow(), SetCapture(), diagnostics…  
PTB-DEBUG: OpenGL initialization of all master-/slave-/shared-/userspace contexts finished…  
PTB-DEBUG: Final low-level window setup: ShowWindow(), SetCapture(), diagnostics…  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: Executed SetForegroundWindow() and SetFocus() on window to optimize pageflipping and timing.  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): WM\_PAINT!  
PTB-DEBUG: MS-Vista+ 1, DWM enabled 1, screen 0, primary 2, monitorDPI 96, primaryDPI 96  
PTB-DEBUG: Final low-level window setup finished. Continuing with OS-independent setup.  
PTB-INFO: Fixed point precision integer framebuffer enabled.  
PTB-INFO: System Frame buffer provides 8 bits for red channel.  
PTB-INFO: System Frame buffer provides 8 bits for green channel.  
PTB-INFO: System Frame buffer provides 8 bits for blue channel.  
PTB-INFO: System frame buffer provides 8 bits for alpha channel, but effective alpha bits depends on imaging pipeline setup, if any.  
PTB-DEBUG: PPM file magic is P6  
 → Ok

# Created by GIMP version 2.10.22 PNM plug-in

PTB-DEBUG: Recognized splash image of 1000 x 750 pixels, maxlevel 255. Loading…

OpenGL-Vendor / renderer / version are: Intel - Intel® HD Graphics 530 - 4.5.0 - Build 22.20.16.4811

OpenGL-Extensions are: GL\_3DFX\_texture\_compression\_FXT1 GL\_AMD\_depth\_clamp\_separate GL\_AMD\_vertex\_shader\_layer GL\_AMD\_vertex\_shader\_viewport\_index GL\_ARB\_ES2\_compatibility GL\_ARB\_ES3\_1\_compatibility GL\_ARB\_ES3\_compatibility GL\_ARB\_arrays\_of\_arrays GL\_ARB\_base\_instance GL\_ARB\_blend\_func\_extended GL\_ARB\_buffer\_storage GL\_ARB\_cl\_event GL\_ARB\_clear\_buffer\_object GL\_ARB\_clear\_texture GL\_ARB\_clip\_control GL\_ARB\_color\_buffer\_float GL\_ARB\_compatibility GL\_ARB\_compressed\_texture\_pixel\_storage GL\_ARB\_compute\_shader GL\_ARB\_conditional\_render\_inverted GL\_ARB\_conservative\_depth GL\_ARB\_copy\_buffer GL\_ARB\_copy\_image GL\_ARB\_cull\_distance GL\_ARB\_debug\_output GL\_ARB\_depth\_buffer\_float GL\_ARB\_depth\_clamp GL\_ARB\_depth\_texture GL\_ARB\_derivative\_control GL\_ARB\_direct\_state\_access GL\_ARB\_draw\_buffers GL\_ARB\_draw\_buffers\_blend GL\_ARB\_draw\_elements\_base\_vertex GL\_ARB\_draw\_indirect GL\_ARB\_draw\_instanced GL\_ARB\_enhanced\_layouts GL\_ARB\_explicit\_attrib\_location GL\_ARB\_explicit\_uniform\_location GL\_ARB\_fragment\_coord\_conventions GL\_ARB\_fragment\_layer\_viewport GL\_ARB\_fragment\_program GL\_ARB\_fragment\_program\_shadow GL\_ARB\_fragment\_shader GL\_ARB\_fragment\_shader\_interlock GL\_ARB\_framebuffer\_no\_attachments GL\_ARB\_framebuffer\_object GL\_ARB\_framebuffer\_sRGB GL\_ARB\_geometry\_shader4 GL\_ARB\_get\_program\_binary GL\_ARB\_get\_texture\_sub\_image GL\_ARB\_gpu\_shader5 GL\_ARB\_gpu\_shader\_fp64 GL\_ARB\_half\_float\_pixel GL\_ARB\_half\_float\_vertex GL\_ARB\_indirect\_parameters GL\_ARB\_instanced\_arrays GL\_ARB\_internalformat\_query GL\_ARB\_internalformat\_query2 GL\_ARB\_invalidate\_subdata GL\_ARB\_map\_buffer\_alignment GL\_ARB\_map\_buffer\_range GL\_ARB\_multi\_bind GL\_ARB\_multi\_draw\_indirect GL\_ARB\_multisample GL\_ARB\_multitexture GL\_ARB\_occlusion\_query GL\_ARB\_occlusion\_query2 GL\_ARB\_pixel\_buffer\_object GL\_ARB\_point\_parameters GL\_ARB\_point\_sprite GL\_ARB\_post\_depth\_coverage GL\_ARB\_program\_interface\_query GL\_ARB\_provoking\_vertex GL\_ARB\_query\_buffer\_object GL\_ARB\_robust\_buffer\_access\_behavior GL\_ARB\_robustness GL\_ARB\_robustness\_isolation GL\_ARB\_sample\_shading GL\_ARB\_sampler\_objects GL\_ARB\_seamless\_cube\_map GL\_ARB\_seamless\_cubemap\_per\_texture GL\_ARB\_separate\_shader\_objects GL\_ARB\_shader\_atomic\_counters GL\_ARB\_shader\_bit\_encoding GL\_ARB\_shader\_draw\_parameters GL\_ARB\_shader\_image\_load\_store GL\_ARB\_shader\_image\_size GL\_ARB\_shader\_objects GL\_ARB\_shader\_precision GL\_ARB\_shader\_stencil\_export GL\_ARB\_shader\_storage\_buffer\_object GL\_ARB\_shader\_subroutine GL\_ARB\_shader\_texture\_image\_samples GL\_ARB\_shading\_language\_100 GL\_ARB\_shading\_language\_420pack GL\_ARB\_shading\_language\_packing GL\_ARB\_shadow GL\_ARB\_stencil\_texturing GL\_ARB\_sync GL\_ARB\_tessellation\_shader GL\_ARB\_texture\_barrier GL\_ARB\_texture\_border\_clamp GL\_ARB\_texture\_buffer\_object\_rgb32 GL\_ARB\_texture\_buffer\_range GL\_ARB\_texture\_compression GL\_ARB\_texture\_compression\_bptc GL\_ARB\_texture\_compression\_rgtc GL\_ARB\_texture\_cube\_map GL\_ARB\_texture\_cube\_map\_array GL\_ARB\_texture\_env\_add GL\_ARB\_texture\_env\_combine GL\_ARB\_texture\_env\_crossbar GL\_ARB\_texture\_env\_dot3 GL\_ARB\_texture\_float GL\_ARB\_texture\_gather GL\_ARB\_texture\_mirror\_clamp\_to\_edge GL\_ARB\_texture\_mirrored\_repeat GL\_ARB\_texture\_multisample GL\_ARB\_texture\_non\_power\_of\_two GL\_ARB\_texture\_query\_levels GL\_ARB\_texture\_query\_lod GL\_ARB\_texture\_rectangle GL\_ARB\_texture\_rg GL\_ARB\_texture\_rgb10\_a2ui GL\_ARB\_texture\_stencil8 GL\_ARB\_texture\_storage GL\_ARB\_texture\_storage\_multisample GL\_ARB\_texture\_swizzle GL\_ARB\_texture\_view GL\_ARB\_timer\_query GL\_ARB\_transform\_feedback2 GL\_ARB\_transform\_feedback3 GL\_ARB\_transform\_feedback\_instanced GL\_ARB\_transpose\_matrix GL\_ARB\_uniform\_buffer\_object GL\_ARB\_vertex\_array\_bgra GL\_ARB\_vertex\_array\_object GL\_ARB\_vertex\_attrib\_64bit GL\_ARB\_vertex\_attrib\_binding GL\_ARB\_vertex\_buffer\_object GL\_ARB\_vertex\_program GL\_ARB\_vertex\_shader GL\_ARB\_vertex\_type\_10f\_11f\_11f\_rev GL\_ARB\_vertex\_type\_2\_10\_10\_10\_rev GL\_ARB\_viewport\_array GL\_ARB\_window\_pos GL\_ATI\_separate\_stencil GL\_EXT\_abgr GL\_EXT\_bgra GL\_EXT\_blend\_color GL\_EXT\_blend\_equation\_separate GL\_EXT\_blend\_func\_separate GL\_EXT\_blend\_minmax GL\_EXT\_blend\_subtract GL\_EXT\_clip\_volume\_hint GL\_EXT\_compiled\_vertex\_array GL\_EXT\_direct\_state\_access GL\_EXT\_draw\_buffers2 GL\_EXT\_draw\_range\_elements GL\_EXT\_fog\_coord GL\_EXT\_framebuffer\_blit GL\_EXT\_framebuffer\_multisample GL\_EXT\_framebuffer\_object GL\_EXT\_geometry\_shader4 GL\_EXT\_gpu\_program\_parameters GL\_EXT\_gpu\_shader4 GL\_EXT\_multi\_draw\_arrays GL\_EXT\_packed\_depth\_stencil GL\_EXT\_packed\_float GL\_EXT\_packed\_pixels GL\_EXT\_polygon\_offset\_clamp GL\_EXT\_rescale\_normal GL\_EXT\_secondary\_color GL\_EXT\_separate\_specular\_color GL\_EXT\_shader\_framebuffer\_fetch GL\_EXT\_shader\_integer\_mix GL\_EXT\_shadow\_funcs GL\_EXT\_stencil\_two\_side GL\_EXT\_stencil\_wrap GL\_EXT\_texture3D GL\_EXT\_texture\_array GL\_EXT\_texture\_compression\_s3tc GL\_EXT\_texture\_edge\_clamp GL\_EXT\_texture\_env\_add GL\_EXT\_texture\_env\_combine GL\_EXT\_texture\_filter\_anisotropic GL\_EXT\_texture\_integer GL\_EXT\_texture\_lod\_bias GL\_EXT\_texture\_rectangle GL\_EXT\_texture\_sRGB GL\_EXT\_texture\_sRGB\_decode GL\_EXT\_texture\_shared\_exponent GL\_EXT\_texture\_snorm GL\_EXT\_texture\_storage GL\_EXT\_texture\_swizzle GL\_EXT\_timer\_query GL\_EXT\_transform\_feedback GL\_IBM\_texture\_mirrored\_repeat GL\_INTEL\_conservative\_rasterization GL\_INTEL\_fragment\_shader\_ordering GL\_INTEL\_framebuffer\_CMAA GL\_INTEL\_map\_texture GL\_INTEL\_multi\_rate\_fragment\_shader GL\_INTEL\_performance\_query GL\_KHR\_blend\_equation\_advanced GL\_KHR\_blend\_equation\_advanced\_coherent GL\_KHR\_context\_flush\_control GL\_KHR\_debug GL\_KHR\_texture\_compression\_astc\_ldr GL\_NV\_blend\_square GL\_NV\_conditional\_render GL\_NV\_primitive\_restart GL\_NV\_texgen\_reflection GL\_SGIS\_generate\_mipmap GL\_SGIS\_texture\_edge\_clamp GL\_SGIS\_texture\_lod GL\_SUN\_multi\_draw\_arrays GL\_WIN\_swap\_hint

PTB-DEBUG: Not running on Mesa graphics library.  
PTB-DEBUG: Interrogating Low-level renderer capabilities for onscreen window with handle 10:  
Indicator variables: FBO’s 1, ATI\_texture\_float 0, ARB\_texture\_float 1, Vendor Intel, Renderer Intel® HD Graphics 530.  
Indicator variables: maxcolorattachments = 8, maxrectangletexturesize = 16384, maxnativealuinstructions = 1447.  
GPU supports non-power-of-two textures.  
Hardware supports signed normalized textures of 16 bpc integer format.  
Basic framebuffer objects with rectangle texture rendertargets supported → RGBA8 rendertargets with blending.  
Framebuffer objects support fast blitting between each other.  
Framebuffer objects support anti-aliasing via multisampling.  
Hardware supports floating point textures of 16bpc and 32bpc float format.  
Assuming HD graphics core or later: Hardware supports full 16/32 bit floating point textures, frame buffers, filtering and blending, as well as some 32 bit float shading.  
Assuming hardware supports native OpenGL primitive smoothing (points, lines).  
Float color value 0.5 → fixed point reads back as 128 ==\> Rounds.  
No compiled in support for OpenML OML\_sync\_control extension.  
PTB-DEBUG: Interrogation done.

PTB-DEBUG: glClear splash image top-left reference pixel: 90 0 90  
PTB-INFO: Threshold Settings for successfull video refresh calibration are: maxStdDev = 0.200000 msecs, maxDeviation = 10.000000 %, minSamples = 50, maxDuration = 5.000000 secs.  
PTB-DEBUG: Could not enable REALTIME\_PRIORITY\_CLASS scheduling! Retrying with HIGH\_PRIORITY\_CLASS…  
PTB-INFO: The detected endline of the vertical blank interval is equal or lower than the startline. This indicates  
PTB-INFO: that i couldn’t detect the duration of the vertical blank interval and won’t be able to correct timestamps  
PTB-INFO: for it. This will introduce a very small and constant offset (typically \<\< 1 msec). Read ‘help BeampositionQueries’  
PTB-INFO: for how to correct this, should you really require that last few microseconds of precision.  
PTB-INFO: Btw. this can also mean that your systems beamposition queries are slightly broken. It may help timing precision to  
PTB-INFO: enable the beamposition workaround, as explained in ‘help ConserveVRAMSettings’, section ‘kPsychUseBeampositionQueryWorkaround’.  
PTB-DEBUG: Could not enable REALTIME\_PRIORITY\_CLASS scheduling! Retrying with HIGH\_PRIORITY\_CLASS…

PTB-DEBUG: Output of all acquired samples of calibration run follows:  
PTB-DEBUG: Sample 0: 0.000000  
PTB-DEBUG: Sample 1: 0.013569  
PTB-DEBUG: Sample 2: 0.016612  
PTB-DEBUG: Sample 3: 0.017030  
PTB-DEBUG: Sample 4: 0.016660  
PTB-DEBUG: Sample 5: 0.016923  
PTB-DEBUG: Sample 6: 0.016338  
PTB-DEBUG: Sample 7: 0.017147  
PTB-DEBUG: Sample 8: 0.016494  
PTB-DEBUG: Sample 9: 0.016990  
PTB-DEBUG: Sample 10: 0.016593  
PTB-DEBUG: Sample 11: 0.016507  
PTB-DEBUG: Sample 12: 0.016665  
PTB-DEBUG: Sample 13: 0.016429  
PTB-DEBUG: Sample 14: 0.017065  
PTB-DEBUG: Sample 15: 0.016502  
PTB-DEBUG: Sample 16: 0.016509  
PTB-DEBUG: Sample 17: 0.017034  
PTB-DEBUG: Sample 18: 0.016264  
PTB-DEBUG: Sample 19: 0.016928  
PTB-DEBUG: Sample 20: 0.016846  
PTB-DEBUG: Sample 21: 0.016511  
PTB-DEBUG: Sample 22: 0.016501  
PTB-DEBUG: Sample 23: 0.017028  
PTB-DEBUG: Sample 24: 0.016286  
PTB-DEBUG: Sample 25: 0.016793  
PTB-DEBUG: Sample 26: 0.016964  
PTB-DEBUG: Sample 27: 0.016510  
PTB-DEBUG: Sample 28: 0.016504  
PTB-DEBUG: Sample 29: 0.017056  
PTB-DEBUG: Sample 30: 0.016360  
PTB-DEBUG: Sample 31: 0.016632  
PTB-DEBUG: Sample 32: 0.016959  
PTB-DEBUG: Sample 33: 0.016560  
PTB-DEBUG: Sample 34: 0.016744  
PTB-DEBUG: Sample 35: 0.016814  
PTB-DEBUG: Sample 36: 0.016493  
PTB-DEBUG: Sample 37: 0.016623  
PTB-DEBUG: Sample 38: 0.016962  
PTB-DEBUG: Sample 39: 0.016462  
PTB-DEBUG: Sample 40: 0.016626  
PTB-DEBUG: Sample 41: 0.016919  
PTB-DEBUG: Sample 42: 0.016437  
PTB-DEBUG: Sample 43: 0.016816  
PTB-DEBUG: Sample 44: 0.016808  
PTB-DEBUG: Sample 45: 0.016282  
PTB-DEBUG: Sample 46: 0.016939  
PTB-DEBUG: Sample 47: 0.016786  
PTB-DEBUG: Sample 48: 0.016368  
PTB-DEBUG: Sample 49: 0.016760  
PTB-DEBUG: Sample 50: 0.016885  
PTB-DEBUG: End of calibration data for this run…

PTB-INFO: OpenGL-Renderer is Intel :: Intel® HD Graphics 530 :: 4.5.0 - Build 22.20.16.4811  
PTB-INFO: VBL startline = 1080 , VBL Endline = 1080  
PTB-INFO: Measured monitor refresh interval from beamposition = 16.681171 ms [59.947828 Hz].  
PTB-INFO: Will use beamposition query for accurate Flip time stamping.  
PTB-INFO: Measured monitor refresh interval from VBLsync = 16.629890 ms [60.132689 Hz]. (50 valid samples taken, stddev=0.504155 ms.)  
PTB-INFO: Reported monitor refresh interval from operating system = 16.949153 ms [59.000000 Hz].  
PTB-INFO: Small deviations between reported values are normal and no reason to worry.  
PTB-INFO: ==============================================================================================================================  
PTB-INFO: WINDOWS DWM DESKTOP COMPOSITOR IS ACTIVE. On this Windows-10 or later system, Psychtoolbox can no longer reliably detect if  
PTB-INFO: this will cause trouble for timing and integrity of visual stimuli or not. You might be just fine, or you could be in trouble.  
PTB-INFO: Use external measurement equipment and independent procedures to verify reliability of timing if you care about proper timing.  
PTB-INFO: ==============================================================================================================================

WARNING: Couldn’t compute a reliable estimate of monitor refresh interval! Trouble with VBL syncing?!?

----- ! PTB - ERROR: SYNCHRONIZATION FAILURE ! -----

One or more internal checks (see Warnings above) indicate that synchronization  
of Psychtoolbox to the vertical retrace (VBL) is not working on your setup.

This will seriously impair proper stimulus presentation and stimulus presentation timing!  
Please read ‘help SyncTrouble’ for information about how to solve or work-around the problem.  
You can force Psychtoolbox to continue, despite the severe problems, by adding the command  
Screen(‘Preference’, ‘SkipSyncTests’, 1); at the top of your script, if you really know what you are doing.

PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
PTB-DEBUG: WndProc(): Called!  
Error using Screen  
See error message printed above.

Error in project (line 44)  
SLM.window = Screen(‘OpenWindow’,0);

Error in main\_projector\_control (line 90)  
[final\_projection\_time] = project(params,projection\_set);

 ![projector](https://global.discourse-cdn.com/free1/uploads/psychtoolbox/original/1X/6a6a984bdcf369aa71fa554462fb1bd7dc6fc7a6.png)

I uploaded the files for the display resolution.  
Please let me know if I have to change something.

---

<div class="post-metadata">

**Author:** ![KeerthanaReddy](https://avatars.discourse-cdn.com/v4/letter/k/f07891/32.png) [@KeerthanaReddy](https://psychtoolbox.discourse.group/u/KeerthanaReddy)\
**Post date:** [March 3, 2021, 10:02pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707/9 "2021-03-03T22:02:31Z")

</div>

![display](https://global.discourse-cdn.com/free1/uploads/psychtoolbox/original/1X/0232daa90a12f3fc9d841929c304ca3785c88dc5.png)

This is the second one as I can only upload one file per post.

---

<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:** [March 5, 2021, 8:30pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707/10 "2021-03-05T20:30:53Z")

</div>

Ok, multiple things:

1. Intel graphics chips on Windows often have broken visual timing. The same graphics chips usually have excellent timing on Linux. That might be a problem, unless you could switch to Linux, which would require some small changes to the toolbox you are using to make the toolbox portable to anything but Windows.

2. The display parameters are rather weird, especially on the projector. This is not a mirror/clone setup, but properly set to “Extend the desktop to both displays” or something like that in the display settings, right? I think both the Desktop resolution and active signal resolution of your “DLP 6500 DP” should report 1920x1080, if that is the maximum resolution of that projector.

3. Most importantly, using screen id 0 is wrong for your use case. This line `Error in project (line 44) SLM.window = Screen(‘OpenWindow’,0);` should not have a hard-coded 0 as screen id, but something that adapts to your setup. Now if i look at the current source code of the CAL toolkit, specifically this one …  
[CAL-software-Matlab/CALProjectImageSet.m at b6acd7369eac0bf139fbdb09b54bb5badf77e98f · computed-axial-lithography/CAL-software-Matlab · GitHub](https://github.com/computed-axial-lithography/CAL-software-Matlab/blob/b6acd7369eac0bf139fbdb09b54bb5badf77e98f/src/CALProjectImageSet.m#L29)

… it looks as if that toolkit would do the right thing if you leave the choice to it, ie., it selects…

`screens = Screen('Screens'); obj.monitor_id = max(screens);`

… which is the right thing for your projector setup.

Are you on the latest version of that toolbox? Or using it in a non-default way?  
Your Psychtoolbox is completely up to date, `UpdatePsychtoolbox`, and thereby has the latest integrated diagnostic code, right?

-mario

[Work time spent so far: 62 minutes - paid-for contingent exhausted from here on].

Btw., also proposed some suggestions to CAL-Toolbox to improve portability and robustness of their code, as a little freebee:

> <https://github.com/computed-axial-lithography/CAL-software-Matlab/pull/3>

---

<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:** [March 6, 2021, 12:12pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707/11 "2021-03-06T12:12:42Z")

</div>

My improvements and some of my suggestions were merged and a new version of that toolbox released. With this new release, maybe the toolbox would also work on non-Windows, ie. Linux, if your windows setup would prove too unreliable. At least their PTB bits won’t block portability, don’t know about other parts of the code - most seems to be plain Matlab.

---

<div class="post-metadata">

**Author:** ![KeerthanaReddy](https://avatars.discourse-cdn.com/v4/letter/k/f07891/32.png) [@KeerthanaReddy](https://psychtoolbox.discourse.group/u/KeerthanaReddy)\
**Post date:** [March 8, 2021, 6:05pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707/12 "2021-03-08T18:05:50Z")

</div>

Thank you,

1. I can’t use other operating system apart from windows, as this is a university computer. That option is ruled out.

2. I think the resolution is different on both the projector and the screen, and I can’t seem to change them.

3. I did update it to the latest version of ‘PTB’.

4. Also, I ran the newer code that was written. without connecting to the projector. It turned my monitor screen white and MATLAB crashed again.  
for refernce: I used the example on the bottom of this page: [Examples — CAL-software-Matlab 1.0.0 documentation](https://cal-software-matlab.readthedocs.io/en/latest/sec_examples.html)

Can you please tell me what is going on?

Thank you

---

<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:** [March 8, 2021, 10:07pm UTC](https://psychtoolbox.discourse.group/t/matlab-crashes-when-i-run-the-program/3707/13 "2021-03-08T22:07:59Z")

</div>

> [@KeerthanaReddy](#):
>
> Thank you,
> 
> 1. I can’t use other operating system apart from windows, as this is a university computer. That option is ruled out.

That is regrettable, because the Intel graphics chip of your computer is really not a good choice for this task under Windows, so this may not be reliable - or fixable - on that setup.

> [@](#):
>
> 1. I think the resolution is different on both the projector and the screen, and I can’t seem to change them.

The resolution is different, as far as i could see from the posted screenshots of the setup GUI, but if you can’t change them, this will most likely not be fixable. Have you tried things like unplugging and replugging the projector, rebooting the machine etc.?

> [@](#):
>
> 1. I did update it to the latest version of ‘PTB’.

So the output of `Screen('Version')` reports a date of at least February 2021?

> [@](#):
>
> 1. Also, I ran the newer code that was written. without connecting to the projector. It turned my monitor screen white and MATLAB crashed again.  
> for refernce: I used the example on the bottom of this page: [Examples — CAL-software-Matlab 1.6.0 documentation](https://cal-software-matlab.readthedocs.io/en/latest/sec_examples.html)

One thing i see when looking even on the latest code is more bugs in that code. E.g., the monitor\_id = 2 that is used in that example you used will get ignored. Instead always the monitor with the highest id will be used, which is usually the right choice. Otherwise you trying without a projector would not have worked at all. Or the fact that your projector resolution is mismatched.

The output you posted from your first run of that software even suggests you weren’t running the proper code at all, but an older broken version stored in their src/archive/ folder for dead code. Something about that toolbox seems to be quite buggy.

> Can you please tell me what is going on?

This could be more bugs in their code, bugs in your operating system - a lot hints at that.

Thank you  
[/quote]

By now my work time on this issue has far exceeded the time you paid for with the priority support - More than twice. So i’m afraid, if you need more attempts at getting this fixed – which may not be easy or possible, given that state of that toolbox and the apparent brokeness of your operating system – you’d have to buy priority support again.

The point you want to get to, to figure out if remaining problems are due to your computer or due to more bugs in that toolbox, is to have our demos running. If our demos don’t run properly then it is a problem with your computer setup and operating system.

1. Make sure you get to set the resolution of the projector to the actual resolution of that projector.

2. Make sure that projector is the main display and you know the screen number of it. `PerceptualVBLSyncTest(n)` with n set to the right number – either 1 or 2 is the right number, but that toolbox assumes 2 is the right number – should give a homogenous gray flicker on the projector.

Iff 2 is indeed the right number, then our other demos should work as well on the projector, e.g., `LinesDemo, DotDemo, DriftDemo` etc.

-mario  
[End of support for this priority support request].
