From: Christopher on
"David Izhaky" <david(a)opt-imaging.com> wrote in message <he3og0$8au$1(a)fred.mathworks.com>...
> I installed Visual Studio 2008 Express in my Win7 x64 and cannot get the compiler to compile a mex file. I tried all suggestions here and other places, and still it does not work. I also installed the trial version of Visual Studio 2008.
>
> This is the error I am getting after configuring mex:
>
> Error: Could not find the 64-bit compiler. This may indicate that the
> "X64 Compilers and Tools" or the Microsoft Windows Software
> Development Kit (SDK) is not installed. To build 64-bit MEX-files
> Microsoft Visual C++ 2008 requires that these two packages are
> installed properly.
>
> and this is the error I am getting when execute mex yprime.c
>
> Error: Could not find the compiler "cl" on the DOS path.
> Use mex -setup to configure your environment properly.
>
>
> C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Unable to locate compiler.
>
> ??? Error using ==> mex at 221
> Unable to complete successfully.

Sorry for the quick double-post on this subject, but I found something interesting.

Previously, I had installed MS Visual Studio 2008 first, then the SDK, as described here:
http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L

However, MATLAB was still unable to find the x64 compiler.

Then, today, I reinstalled MS VS, or rather, I ran the setup again and "repaired" the installation. To my surprise, it appeared that more x64 options were being installed than before. Perhaps this installation recognized the MS SDK installation and decided to install more x64 stuff on its own. Also to my surprise, MATLAB afterwards found the x64 compiler. Does the SDK (only Developer Tools > Visual C++ Compilers) need to be installed *before* Visual Studio?

At any rate, at least the Simulink Accelerator appears to be working now. Unfortunately, I'm having trouble using Embedded MATLAB blocks in Simulink and I cannot run mex on the example in the solution page above. When I run the following code:

copyfile(fullfile(matlabroot,'extern','examples','mex','yprime.c'))
mex -v yprime.c
yprime(1,1:4)

I get at the output:

This is mex, Copyright 1984-2007 The MathWorks, Inc.

-> Default options filename found in C:\Users\Chris\AppData\Roaming\MathWorks\MATLAB\R2009b
----------------------------------------------------------------
-> Options file = C:\Users\Chris\AppData\Roaming\MathWorks\MATLAB\R2009b\mexopts.bat
MATLAB = C:\PROGRA~1\MATLAB\R2009B
-> COMPILER = cl
-> Compiler flags:
COMPFLAGS = /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
OPTIMFLAGS = /O2 /Oy- /DNDEBUG
DEBUGFLAGS = /Z7
arguments =
Name switch = /Fo
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\PROGRA~1\MATLAB\R2009B\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.x" /MAP:"yprime.mexw64.map"
LINKDEBUGFLAGS = /DEBUG /PDB:"yprime.mexw64.pdb"
LINKFLAGSPOST =
Name directive = /out:"yprime.mexw64"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------


--> cl /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /FoC:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\yprime.obj -IC:\PROGRA~1\MATLAB\R2009B\extern\include -IC:\PROGRA~1\MATLAB\R2009B\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 yprime.c

yprime.c
yprime.c(85) : warning C4267: '=' : conversion from 'size_t' to 'mwSize', possible loss of data
yprime.c(86) : warning C4267: '=' : conversion from 'size_t' to 'mwSize', possible loss of data
Contents of C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\mex_tmp.rsp:
C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\yprime.obj


--> link /out:"yprime.mexw64" /dll /export:mexFunction /LIBPATH:"C:\PROGRA~1\MATLAB\R2009B\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.x" /MAP:"yprime.mexw64.map" @C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\MEX_TMP.RSP

Creating library C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.x and object C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.exp

--> del "C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.x" "C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.exp"


--> mt -outputresource:"yprime.mexw64;2" -manifest "yprime.mexw64.manifest"

'mt' is not recognized as an internal or external command,
operable program or batch file.

--> del "yprime.mexw64.manifest"


--> del "yprime.mexw64.map"

??? Invalid MEX-file 'C:\cygwin\home\Chris\research\rotations\so3\simulation\yprime.mexw64': The specified module could not be found.


Unfortunately, a search on this error yielded only the following page:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/166600

I will see if I can get MATLAB to find 'mt' as well.
From: Christopher on
For further documentation, when I try to use Embedded MATLAB, I get the following error when I click the 'Build' button from an Embedded MATLAB block:

Embedded MATLAB Interface Error: Error calling generated SFunction, attitude_control_sfun

Sometimes, if I try to run the simulation (after the build fails, with the error dialog still open), it will produce the following error:

Making simulation target "attitude_control_sfun", ...



C:\cygwin\home\Chris\research\rotations\so3\simulation\slprj\_sfprj\attitude_control\_self\sfun\src>call "mexopts.bat"

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

### Compiling "attitude_control_sfun.c"
cl.exe /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /MD /I "c:\program files\matlab\r2009b\extern\include" /I "c:\program files\matlab\r2009b\simulink\include" /I "c:\program files\matlab\r2009b\stateflow\c\mex\include" /I "c:\program files\matlab\r2009b\stateflow\c\debugger\include" "attitude_control_sfun.c"
attitude_control_sfun.c
attitude_control_sfun.c(7) : fatal error C1083: Cannot open include file: 'c5_attitude_control.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\cl.exe"' : return code '0x2'
Stop.

This error seems to have something in common with the post
http://www.mathworks.com/matlabcentral/newsreader/view_thread/270052
where the author is also having problems running MATLAB on x64 Win7.

From: Iulian on
"Christopher " <christopher.mayhew(a)gmail.com> wrote in message <hrs299$8n5$1(a)fred.mathworks.com>...
> "David Izhaky" <david(a)opt-imaging.com> wrote in message <he3og0$8au$1(a)fred.mathworks.com>...
> > I installed Visual Studio 2008 Express in my Win7 x64 and cannot get the compiler to compile a mex file. I tried all suggestions here and other places, and still it does not work. I also installed the trial version of Visual Studio 2008.
> >
> > This is the error I am getting after configuring mex:
> >
> > Error: Could not find the 64-bit compiler. This may indicate that the
> > "X64 Compilers and Tools" or the Microsoft Windows Software
> > Development Kit (SDK) is not installed. To build 64-bit MEX-files
> > Microsoft Visual C++ 2008 requires that these two packages are
> > installed properly.
> >
> > and this is the error I am getting when execute mex yprime.c
> >
> > Error: Could not find the compiler "cl" on the DOS path.
> > Use mex -setup to configure your environment properly.
> >
> >
> > C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Unable to locate compiler.
> >
> > ??? Error using ==> mex at 221
> > Unable to complete successfully.
>
> Sorry for the quick double-post on this subject, but I found something interesting.
>
> Previously, I had installed MS Visual Studio 2008 first, then the SDK, as described here:
> http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L
>
> However, MATLAB was still unable to find the x64 compiler.
>
> Then, today, I reinstalled MS VS, or rather, I ran the setup again and "repaired" the installation. To my surprise, it appeared that more x64 options were being installed than before. Perhaps this installation recognized the MS SDK installation and decided to install more x64 stuff on its own. Also to my surprise, MATLAB afterwards found the x64 compiler. Does the SDK (only Developer Tools > Visual C++ Compilers) need to be installed *before* Visual Studio?
>
> At any rate, at least the Simulink Accelerator appears to be working now. Unfortunately, I'm having trouble using Embedded MATLAB blocks in Simulink and I cannot run mex on the example in the solution page above. When I run the following code:
>
> copyfile(fullfile(matlabroot,'extern','examples','mex','yprime.c'))
> mex -v yprime.c
> yprime(1,1:4)
>
> I get at the output:
>
> This is mex, Copyright 1984-2007 The MathWorks, Inc.
>
> -> Default options filename found in C:\Users\Chris\AppData\Roaming\MathWorks\MATLAB\R2009b
> ----------------------------------------------------------------
> -> Options file = C:\Users\Chris\AppData\Roaming\MathWorks\MATLAB\R2009b\mexopts.bat
> MATLAB = C:\PROGRA~1\MATLAB\R2009B
> -> COMPILER = cl
> -> Compiler flags:
> COMPFLAGS = /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
> OPTIMFLAGS = /O2 /Oy- /DNDEBUG
> DEBUGFLAGS = /Z7
> arguments =
> Name switch = /Fo
> -> Pre-linking commands =
> -> LINKER = link
> -> Link directives:
> LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\PROGRA~1\MATLAB\R2009B\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.x" /MAP:"yprime.mexw64.map"
> LINKDEBUGFLAGS = /DEBUG /PDB:"yprime.mexw64.pdb"
> LINKFLAGSPOST =
> Name directive = /out:"yprime.mexw64"
> File link directive =
> Lib. link directive =
> Rsp file indicator = @
> -> Resource Compiler = rc /fo "mexversion.res"
> -> Resource Linker =
> ----------------------------------------------------------------
>
>
> --> cl /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /FoC:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\yprime.obj -IC:\PROGRA~1\MATLAB\R2009B\extern\include -IC:\PROGRA~1\MATLAB\R2009B\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 yprime.c
>
> yprime.c
> yprime.c(85) : warning C4267: '=' : conversion from 'size_t' to 'mwSize', possible loss of data
> yprime.c(86) : warning C4267: '=' : conversion from 'size_t' to 'mwSize', possible loss of data
> Contents of C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\mex_tmp.rsp:
> C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\yprime.obj
>
>
> --> link /out:"yprime.mexw64" /dll /export:mexFunction /LIBPATH:"C:\PROGRA~1\MATLAB\R2009B\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.x" /MAP:"yprime.mexw64.map" @C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\MEX_TMP.RSP
>
> Creating library C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.x and object C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.exp
>
> --> del "C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.x" "C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.exp"
>
>
> --> mt -outputresource:"yprime.mexw64;2" -manifest "yprime.mexw64.manifest"
>
> 'mt' is not recognized as an internal or external command,
> operable program or batch file.
>
> --> del "yprime.mexw64.manifest"
>
>
> --> del "yprime.mexw64.map"
>
> ??? Invalid MEX-file 'C:\cygwin\home\Chris\research\rotations\so3\simulation\yprime.mexw64': The specified module could not be found.
>
>
> Unfortunately, a search on this error yielded only the following page:
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/166600
>
> I will see if I can get MATLAB to find 'mt' as well.

Hello,

I had the same problem. It seems that "Microsoft Windows SDK for Windows 7 and .NET Framework 4" released in May 2010 have a bug : the mexopts.bat file is not correctly generated . I uninstall this version and install "Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 Service Pack 1" from that link http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&displaylang=en . If it still doesn't work, I can send you my mexopts.bat file. I tested on two different PC ( Windows 7 64 bit) and works very good.
Please let me know if this solves your problem.

Best regards,
Iulian
From: Mustafa on
"Christopher " <christopher.mayhew(a)gmail.com> wrote in message <hrs299$8n5$1(a)fred.mathworks.com>...
> "David Izhaky" <david(a)opt-imaging.com> wrote in message <he3og0$8au$1(a)fred.mathworks.com>...
> > I installed Visual Studio 2008 Express in my Win7 x64 and cannot get the compiler to compile a mex file. I tried all suggestions here and other places, and still it does not work. I also installed the trial version of Visual Studio 2008.
> >
> > This is the error I am getting after configuring mex:
> >
> > Error: Could not find the 64-bit compiler. This may indicate that the
> > "X64 Compilers and Tools" or the Microsoft Windows Software
> > Development Kit (SDK) is not installed. To build 64-bit MEX-files
> > Microsoft Visual C++ 2008 requires that these two packages are
> > installed properly.
> >
> > and this is the error I am getting when execute mex yprime.c
> >
> > Error: Could not find the compiler "cl" on the DOS path.
> > Use mex -setup to configure your environment properly.
> >
> >
> > C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Unable to locate compiler.
> >
> > ??? Error using ==> mex at 221
> > Unable to complete successfully.
>
> Sorry for the quick double-post on this subject, but I found something interesting.
>
> Previously, I had installed MS Visual Studio 2008 first, then the SDK, as described here:
> http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L
>
> However, MATLAB was still unable to find the x64 compiler.
>
> Then, today, I reinstalled MS VS, or rather, I ran the setup again and "repaired" the installation. To my surprise, it appeared that more x64 options were being installed than before. Perhaps this installation recognized the MS SDK installation and decided to install more x64 stuff on its own. Also to my surprise, MATLAB afterwards found the x64 compiler. Does the SDK (only Developer Tools > Visual C++ Compilers) need to be installed *before* Visual Studio?
>
> At any rate, at least the Simulink Accelerator appears to be working now. Unfortunately, I'm having trouble using Embedded MATLAB blocks in Simulink and I cannot run mex on the example in the solution page above. When I run the following code:
>
> copyfile(fullfile(matlabroot,'extern','examples','mex','yprime.c'))
> mex -v yprime.c
> yprime(1,1:4)
>
> I get at the output:
>
> This is mex, Copyright 1984-2007 The MathWorks, Inc.
>
> -> Default options filename found in C:\Users\Chris\AppData\Roaming\MathWorks\MATLAB\R2009b
> ----------------------------------------------------------------
> -> Options file = C:\Users\Chris\AppData\Roaming\MathWorks\MATLAB\R2009b\mexopts.bat
> MATLAB = C:\PROGRA~1\MATLAB\R2009B
> -> COMPILER = cl
> -> Compiler flags:
> COMPFLAGS = /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD
> OPTIMFLAGS = /O2 /Oy- /DNDEBUG
> DEBUGFLAGS = /Z7
> arguments =
> Name switch = /Fo
> -> Pre-linking commands =
> -> LINKER = link
> -> Link directives:
> LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\PROGRA~1\MATLAB\R2009B\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.x" /MAP:"yprime.mexw64.map"
> LINKDEBUGFLAGS = /DEBUG /PDB:"yprime.mexw64.pdb"
> LINKFLAGSPOST =
> Name directive = /out:"yprime.mexw64"
> File link directive =
> Lib. link directive =
> Rsp file indicator = @
> -> Resource Compiler = rc /fo "mexversion.res"
> -> Resource Linker =
> ----------------------------------------------------------------
>
>
> --> cl /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /FoC:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\yprime.obj -IC:\PROGRA~1\MATLAB\R2009B\extern\include -IC:\PROGRA~1\MATLAB\R2009B\simulink\include /O2 /Oy- /DNDEBUG -DMX_COMPAT_32 yprime.c
>
> yprime.c
> yprime.c(85) : warning C4267: '=' : conversion from 'size_t' to 'mwSize', possible loss of data
> yprime.c(86) : warning C4267: '=' : conversion from 'size_t' to 'mwSize', possible loss of data
> Contents of C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\mex_tmp.rsp:
> C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\yprime.obj
>
>
> --> link /out:"yprime.mexw64" /dll /export:mexFunction /LIBPATH:"C:\PROGRA~1\MATLAB\R2009B\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.x" /MAP:"yprime.mexw64.map" @C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\MEX_TMP.RSP
>
> Creating library C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.x and object C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.exp
>
> --> del "C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.x" "C:\USERS\CHRIS\APPDATA\LOCAL\TEMP\MEX_LY~1\templib.exp"
>
>
> --> mt -outputresource:"yprime.mexw64;2" -manifest "yprime.mexw64.manifest"
>
> 'mt' is not recognized as an internal or external command,
> operable program or batch file.
>
> --> del "yprime.mexw64.manifest"
>
>
> --> del "yprime.mexw64.map"
>
> ??? Invalid MEX-file 'C:\cygwin\home\Chris\research\rotations\so3\simulation\yprime.mexw64': The specified module could not be found.
>
>
> Unfortunately, a search on this error yielded only the following page:
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/166600
>
> I will see if I can get MATLAB to find 'mt' as well.


Chris,

I had a very similar problem (ie after installation mt.exe was not recognized).

Solution is to install the developer tools in SDK as well. As far as I can tell, you did not choose to install the developer tools so you do not get mt.exe in your SDK installation.

I hope this helps
From: Christopher on
"Mustafa " <dokucu(a)ge.com> wrote in message <hu8g7a$aol$1(a)fred.mathworks.com>...
> Chris,
>
> I had a very similar problem (ie after installation mt.exe was not recognized).
>
> Solution is to install the developer tools in SDK as well. As far as I can tell, you did not choose to install the developer tools so you do not get mt.exe in your SDK installation.
>
> I hope this helps

Hi Mustafa,

As you might see from my post above (Date: 5 May, 2010 14:31:20, Message: 11 of 15), I installed
Developer Tools > Visual C++ Compilers
and
Developer Tools > Windows Headers and Libraries
from the SDK, which apparently inclues mt.exe (maybe just the VC++ compilers?)

As it turns out, the response above yours, (From: Iulian, Date: 25 May, 2010 18:03:21, Message: 14 of 15) seems to be the right respose - my mexopts.bat file was not being generated properly. Instead, I was able to solve the problem using the solution posted on
http://www.mathworks.com/matlabcentral/fileexchange/22689),
after hacking around with it a little bit.