Issues running a Mex Function (.mexw64)

22 次查看(过去 30 天)
Ryan de Silva
Ryan de Silva 2021-10-15
回答: Jan 2021-10-16
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 ./optixRaycasting_generated_OptiXRaycastingContext.cu.ptx"
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.
  2 个评论
Jan
Jan 2021-10-15
Please explain exactly, when this message appears. Does "When I run it" mean the compilation or the calling?
I guess, that the compiled function try to open this file and does not find it. Adding the folder to Matlab's path does not help, because the C code does not search in the path automatically.
Did you write thefunction? Is there any documentation which explains, where this file should be stored?
Ryan de Silva
Ryan de Silva 2021-10-15
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.

请先登录,再进行评论。

回答(1 个)

Jan
Jan 2021-10-16
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.

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by