MATLAB: How to use the MEX, MCC, and MBUILD commands on a local machine when I have a PC network installation of MATLAB

-setupconflictincMATLABmexmexsetup.pmNetworkpcperlpl

How do I use the MEX, MCC, and MBUILD commands on a local machine when I have a PC network installation of MATLAB?
Why do I receive the following error when I call MEX or MBUILD?
Can't locate mexsetup.pm in @INC (@INC contains: N:
\pc_apps\win32app\Matlabr12/sys/perl/win32/lib N:
\pc_apps\win32app\Matlabr12/sys/perl/win32/site/lib
N:/win32app/Matlabr12/sys/perl/win32/lib
N:/win32app/Matlabr12/sys/perl/win32/site/lib . N:
\pc_apps\win32app\Matlabr12/bin/win32) at N:
\win32app\Matlabr12\bin\win32\mex.bat\..\mex.pl line 68.
BEGIN failed--compilation aborted at N:\win32app\Matlabr12
\bin\win32\mex.bat\..\mex.pl line 68.
The system cannot find the path specified.
??? Error using ==> mex
Unable to complete successfully

Best Answer

This error is the result of a conflict between the drive letter specification of the drive where MATLAB is installed and the drive letter specification used at run time. This is usually the result of MATLAB being installed on one computer while it is being accessed over a network from another.
Please try the following to use the MEX, MCC, MBUILD commands on a MATLAB PC network installation:
1.On the network, edit mex.bat and mbuild.bat to add an extra level of indirection in locating MATLAB. You need to change:
set MATLAB=X:\matlab
to:
set MATLAB=%MATLAB%
2. On each computer from which MEX or MBUILD is to be called, add an environment variable called MATLAB and set it to the root directory of MATLAB, relative to that computer. To do this on Windows 95, Windows 98, and Windows ME, edit the autoexec.bat file and add a line similar to the following:
set MATLAB=Y:\matlab
To do this on Windows NT and 2000, right-click on the My Computer icon, select properties, select the Environment tab, and add a MATLAB entry to the System Variables section.