Nsight Debug %1 is not a valid win32 application

I have a VS 2010 project where I have a .cu file that adds two vectors. It is the one from cuda sdk 5.5 samples. Also, I have replaced the main function with a mexfunction and made the correct changes in order to run the function via matlab and works fine. Then I tried to run the CUDA Debugging but did not start. It returns the following error:

Nsight Debug
%1 is not a valid win32 application
(System.ComponentModel.Win32Exception)

Any ideas what is wrong?

Thank you in advance.

PS: Win 7 64x, VS 2010, CUDA SDK 5.5 64x, Nsight 3.1 64x, the project in visual studio is 64x build.

@solution: For those who have already read the question the answer is because the output is a .mexw64 file which can not be debugged explicitly neither with classic cpu nor with gpu debug. You must attach matlab in visual studio and then the debug will work.

Yup, ran into the same thing myself duplicating my CUDA mex debugging setup. Seems you already got it to work.

Regardless, for the benefits of others, I did a run-through of instructions here: [url]Integrate .cu .cpp and .mex64 file under matlab - CUDA Programming and Performance - NVIDIA Developer Forums