2

I'm having trouble getting a compiled .exe file to run with MCR instead of Matlab (I can tell because the program is using multiple threads, which it would not do if it were running with MCR). The MATLAB documentation (http://www.mathworks.com/help/toolbox/compiler/f12-999353.html) says:

"To run deployed components against the MCR install, mcr_root\ver\runtime\win32|win64 must appear on your system path before matlabroot\runtime\win32|win64.

If mcr_root\ver\runtime\arch appears first on the compiled application path, the application uses the files in the MCR install area.

If matlabroot\runtime\arch appears first on the compiled application path, the application uses the files in the MATLAB Compiler installation area."

Can anyone connect the dots a bit more for me? I don't know what this means. Thanks!

user1189728
  • 157
  • 1
  • 4
  • 8

2 Answers2

1

I had the same problem: my compiled code was multithreaded, which I did not want.

The problem got solved by compiling with the option:

-R -singleCompThread

Oli
  • 15,935
  • 7
  • 50
  • 66
  • Thanks--that is a really useful option to know. I think there is still another problem in my case because when I run the same exe on a computer that does not have MATLAB it only uses one thread, so I don't think it's the exe itself. I'm more concerned with using MCR vs MATLAB than with the number of threads per se. – user1189728 Mar 20 '12 at 22:56
0

You need to set properly the PATH global environment variable in Windows. How you do it exactly depends on Windows version.

Here is the first link from Google by query "set path on Windows": http://www.computerhope.com/issues/ch000549.htm

This variable is a list of directories. Make sure you have a directory with MCR executable earlier in this list than a directory with MATLAB executable.

yuk
  • 19,098
  • 13
  • 68
  • 99
  • Thanks for the response. I tried setting the PATH variable, but nothing changed. The list also did not contain any directories with the MATLAB executable. – user1189728 Mar 20 '12 at 22:53
  • Check in your code the PATH variable by `getenv('path')`. Try also to restart the computer after setting path. – yuk Mar 21 '12 at 01:57