Issues running a Mex Function (.mexw64)

2 views (last 30 days)
Ryan de Silva
Ryan de Silva on 15 Oct 2021
Answered: Jan on 16 Oct 2021
Hi I am very new to Matlab Mex functions. I was able to compile and create a .mexw64 file using Visual Studio 2019 which I am calling from Matlab. When I run it I get the following error:
"Couldn't open source file ./"
I foulnd the specified file and added its path to the Matlab path as well. I am unfamiliar with files of type .ptx and I am not sure if this is an error associated with the build of the mex function itself or something that I may not be doing on the Matlab side of things.
Ryan de Silva
Ryan de Silva on 15 Oct 2021
Hi thanks for the reply. So when I say run it I mean that I am calling the compiled .mexw64 function through my matlab script. As soon as I run the script it reaches the line where I call on the function and then displays the above error message.
As for the function itself, it was written by another grad student whose research I am taking over and I am trying to recreate some of his results.

Sign in to comment.

Answers (1)

Jan on 16 Oct 2021
The leading "./" means, that it is searching in the current folder. Assuming, that the current folder is chosen as expected, is a standard source of bugs. Prefer absolute file names. Search in the file for the command, to open this file, and include the abolute path there. If this does not work for any reasons, use cd() to change to the folder, in which the file is found.





Community Treasure Hunt

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

Start Hunting!