# An error detected while a MEX-file(for sending EEG triggers) was running

**URL:** <https://psychtoolbox.discourse.group/t/an-error-detected-while-a-mex-file-for-sending-eeg-triggers-was-running/5053>\
**Category:** Bugs & Features\
**Tags:** windows\
**Created:** [July 13, 2023, 11:17am UTC](https://psychtoolbox.discourse.group/t/an-error-detected-while-a-mex-file-for-sending-eeg-triggers-was-running/5053 "2023-07-13T11:17:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chensr](https://avatars.discourse-cdn.com/v4/letter/c/3d9bf3/32.png) [@Chensr](https://psychtoolbox.discourse.group/u/Chensr)\
**Post date:** [July 13, 2023, 11:17am UTC](https://psychtoolbox.discourse.group/t/an-error-detected-while-a-mex-file-for-sending-eeg-triggers-was-running/5053/1 "2023-07-13T11:17:44Z")

</div>

I was testing an EEG experiment on my PC(no amplifier connected), and am not sure if the error is due to the lack of amplfier connection. The PTB window crashed after loading for aprox 5 mins, and here is the crash report. Would the ‘Access Violation’ in the tiltle possibly mean no access to an amplifier, thus resulting in inablity to send triggers, which led to the crash?  
MATLAB Log File: C:\Users\admin\AppData\Local\Temp\matlab\_crash\_dump.18064-1

* * *

## MATLAB Log File

* * *

```
         Access violation detected at 2023-07-13 18:52:18 +0800

```

* * *

Configuration:  
Crash Decoding : Disabled - No sandbox or build area path  
Crash Mode : continue (default)  
Default Encoding : UTF-8  
Deployed : false  
Graphics Driver : Intel Intel(R) UHD Graphics 770 Version 4.5.0 - Build 31.0.101.4338  
Graphics card 1 : Intel Corporation ( 0x8086 ) Intel(R) UHD Graphics 770 Version 31.0.101.4338 (2023-5-12)  
Java Version : Java 1.8.0\_202-b08 with Oracle Corporation Java HotSpot™ 64-Bit Server VM mixed mode  
MATLAB Architecture : win64  
MATLAB Entitlement ID : 6428037  
MATLAB Root : E:\matlab2022b  
MATLAB Version : 9.13.0.2080170 (R2022b) Update 1  
OpenGL : hardware  
Operating System : Microsoft Windows 10 专业版  
Process ID : 18064  
Processor ID : x86 Family 6 Model 151 Stepping 2, GenuineIntel  
Session Key : 7e361b3d-3350-4d2a-95c6-561dd78032c6  
Window System : Version 10.0 (Build 19044)

Fault Count: 1

Abnormal termination:  
Access violation

Current Thread: ‘MCR 0 interpreter thread’ id 12956

Register State (from fault):  
RAX = 0000021cd64c4660 RBX = 0000000000000000  
RCX = 0000000000000378 RDX = 0000000000000000  
RSP = 000000cfd69f8c78 RBP = 000000cfd69f8e50  
RSI = 000000cfd69f98f8 RDI = 0000000000000378

R8 = 0000021cd64c3f00 R9 = 0000000000000000  
R10 = 7efefefefeff3f3f R11 = 8101010101010100  
R12 = 000000cfd69f98f8 R13 = 0000021b296346f0  
R14 = 000000cfd69f8d70 R15 = 0000000000000001

RIP = 0000021cd64c0150 EFL = 00010202

CS = 0033 FS = 0053 GS = 002b

This error was detected while a MEX-file was running. If the MEX-file  
is not an official MathWorks function, please examine its source code  
for errors. Please consult the External Interfaces Guide for information  
on debugging MEX-files.

---

<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 13, 2023, 4:21pm UTC](https://psychtoolbox.discourse.group/t/an-error-detected-while-a-mex-file-for-sending-eeg-triggers-was-running/5053/2 "2023-07-13T16:21:02Z")

</div>

It’s a crash, probably in the mex file you use for EEG triggering, not in Psychtoolbox, but your report contains no meaningful information for anybody to find out or help you.

But then, seeing your machine uses Intel integrated graphics on a Windows operating system, you can be almost certain that your visual stimulation timing is broken anyway, so the whole concept of sending EEG triggers related to visual stimulus timing with any toolkit on that machine is probably quite pointless.

If you provide more details, maybe some volunteer other than me can help you, but only a different graphics card or switching to Linux could fix your stimulation timing or EEG trigger timing, if my suspicion about your setup is correct.

Good luck.
