MATLAB: Multithreading does not work for external programs called by the ‘system’ command

MATLABmultithreadingsystem command

I am using Matlab R2010a on a Windows Server 2003 computer in combination with an external program. The external program is called by the 'system' command. The external program does not use multithreading. If you run the external program outside Matlab (by running it from the DOS-prompt) it uses multithreading. Is there a possibility to use multithreading for programs called by the 'system' command?

Best Answer

I have seen this before. I think this is how we resolved it.
Basically, MATLAB and Windows may use different environment variables.
If your application is using the OMP_NUM_THREADS environment variable, you can set this directly in MATLAB.
setenv('OMP_NUM_THREADS',numOfThreads);
Related Question