nvcc in matlab R2012b

Hi All
I have this configuration win7 64bit,
Geforce GT 520M Graphic card
CUDA Driver version 6.5
I have the Cuda file in matlab .cu file like AddVectors.cu
when I compile it in matlab command window with:
system(‘nvcc -c AddVectors.cu’)
I have this error:

nvcc fatal : Cannot find compiler ‘cl.exe’ in PATH

ans =

 1

for solve this problem I define this Path in Control Panel Advance System settings->Advanced tag->Environment variable->System variables. with value: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe

and the name cl_PATH

then I close the matlab program and open it again but not working too.

I copy this file and paste it in current project but not working and have another error.

So I use this in command window:

system(‘nvcc -c AddVectors.cu -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin”’)

in this time I have this error:

AddVectors.cu(2) : fatal error C1083: Cannot open include file: ‘mex.h’: No such file or directory
AddVectors.cu

ans =

 2

for solve it I copy mex.h in extern folder of matlab and paste it in currect project but have another error…

is there any one help me…
I have this problem for along time…
please help me…

From my limited experience, people who want to use matlab with CUDA use either the mex-interface or the PTX interface. The mathworks has good tutorials for both methods.

Also, Orange Owl solutions has published a tutorial that is generally considered to be useful for the mex method:

http://www.orangeowlsolutions.com/archives/498