MATLAB: Matlab does not recognize the executable file unless I locate it in the Matlab shortcut’s start path

.mexw64'start folder'dllsenvironmentexecutableMATLABpath

Environment: 1) Windows 7 64 bit 2) Matlab R2011b 3) Windows path environment variable includes the path to my *.mexw64 file and all its required dll's. 4) Matlab path variable includes the path to my *.mexw64 file
Issue: Matlab does not recognize my 'C' executable 'ConnSpiderServer.mexw64' unless I locate it in the start folder of the Matlab shortcut. (When I locate it there my command works fine).

Best Answer

I talked with Matlab's Technical Support, and between us we found the solution.
First Matlab uses a file known as pathdef.m to define its paths. This file is located at %MATLAB_ROOT%\toolbox\local. I was using a startup.m file to add the path to my *.mexw64 file, but this extra path was not updating the pathdef.m file that Matlab uses. Apparently, (even though I was starting Matlab as a user with administrator rights), the pathdef.m file was not getting updated by startup.m. The solution was to manually edit pathdef.m, save it to a temporary folder, and then to copy it to the %MATLAB_ROOT%\toolbox\local location. (Windows 7 asks perimission to perform the copy when you do this). After doing this Matlab can now see ConnSpiderServer.mexw64 (my mex command).