How to solve error 'Invalid mex file'

Hi,
I am trying to run a script on MATLAB using the psychtoolbox, but I keep getting this error -
'Invalid MEX-file ‘C:\toolbox\Psychtoolbox\PsychBasic\MatlabWindowsFilesR2007a\Eyelink.mexw64’: The specified module could not be found.'
The mex file is right there when I go into the MatlabWindowsFiles folder, and I have installed the GStreamer runtime and vcredist. I have also tried the Dependency Walker to find missing .dll files, and everything is added to my path, but I still get the error.
I am working on a Windows 10 laptop with a 64-bit operating system and a x64-based processor. The MATLAB versions I have is R2020b.
I cannot think of anything else to try so any suggestions would be greatly appreciated.
Thank you!

2 件のコメント

Jan
Jan 2022 年 4 月 11 日
Do you have installed the correct vcredist version? Ist the dependency walker satisfied?
Abi Wyllie
Abi Wyllie 2022 年 4 月 11 日
I think so - I downloaded the vcredist_x64_2015-2019 as specified in the Psychtoolbox page (http://psychtoolbox.org/download.html#Windows - step 4) and I have tried to download the dependency walker again and it gave me no new .dll files like last time and when I opened the dependency walker window I couldn't find anything written there.

サインインしてコメントする。

回答 (2 件)

Ganesh Gudipati
Ganesh Gudipati 2022 年 4 月 14 日

0 投票

Hi,
Generally the first step is to check if the mupadmex.mexw64 file is present in path shown in the error. And, you already did it.
Now make sure, you have permissions to read and execute this file.
If you have the file and permissions but still you are facing an issue, then the problem may be realted to a false detection from an antivirus program. Please check your antivirus software to see if there have been any files quarantined from your MATLAB installation. If there are files from your MATLAB installation directory that have been quarantined, please restore them.
Then, you may need to create an exception in your antivirus program for the MATLAB installation folder and it's subfolders.
Check this Previous MATLAB answer if required.
Hope this helps.

3 件のコメント

Hazel
Hazel 2023 年 10 月 27 日
編集済み: Hazel 2023 年 10 月 27 日
Hello,
I am having the same problem yet none of the listed solutions has fixed the problem. Selected folders and subfolders are added to my path.
'Invalid MEX-file 'C:\Users\me\OneDrive\Documents\Code\Psychtoolbox-3\Psychtoolbox\MatlabWindowsFilesR2007a\Screen.mexw64': The specified module could not be found.'
Do you have another solution?
Thanks!
Maite
Maite 2025 年 3 月 5 日

Hi Hazel, How did you fix the error??

Thanks :)

Huw
Huw 約23時間 前
編集済み: Huw 約23時間 前
Hello all, I have a fix, provided you follow the install via zip file instructions on PTB website.
When you run SetupPsychtoolbox or PsychStartup (which is also called by setup), at line 50 in psychstartup is: sdkroot = getenv('GSTREAMER_1_0_ROOT_MSVC_X86_64');
Depending on factors known only to god, on some systems and installs this returns 'C:\Program Files\gstreamer\1.0\msvc_x86_64\' and others it can return 'C:\Program Files\gstreamer\1.0\msvc_x86_64' without the trailing slash.
Following in the script is the section %probe standard install location on drives C,D,E,F,G where 'bin' is appended to the path returned for sdkroot, however it's appended as:
sdkroot = [sdkroot 'bin'], meaning that you will get an incorrect path of 'gstreamer\1.0\msvc_x86_64bin' rather than 'gstreamer\1.0\msvc_x86_64\bin'
Changing the script to "fullfile(sdkroot,bin)" guarantees that it will always return the valid path, regardless of the original pathing problem, this resolves the issue provided all else is install correctly. You will need to re-run setuppsychtoolbox again.

サインインしてコメントする。

Muhammad Fawad
Muhammad Fawad 2022 年 11 月 27 日

0 投票

hello bro
you need to first download MATLAB 2014b version to MATLAB 2022B
Then go Add-ons and check Psychtoolbox page if not avalible then download

カテゴリ

製品

リリース

R2020b

質問済み:

2022 年 4 月 11 日

編集済み:

Huw
2026 年 5 月 18 日 13:56

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by