I have a MATLAB script using parallel for
loops. I want to run my script on a Linux server but I don't know how can I run it from the linux shell without displaying the MATLAB GUI. Also, how can I specify number of cores to use?
1 Answer
matlab -nodesktop
- Use
maxNumCompThreads
to set the total number of threads / cores for MATLAB to use.
If you require MATLAB to run on a single thread, use matlab -singleCompThread
. However, I'm not sure why you'd want to control the total number of cores. By default, MATLAB makes use of the multithreading capabilities of the machine it's running on.
As an additional sidenote, maxNumCompThreads
will be removed in future releases of MATLAB, so don't rely on this behaviour if you desire longetivity.
matlab --nodesktop
do what you want? See: blogs.mathworks.com/community/2010/02/22/…