Get CPU count from Matlab
Capture the number of physical CPU cores available on a computer from Matlab:
function N = get_cpu_count()
%% get apparent number of physical CPU cores
N = maxNumCompThreads;
if N < 2 % happens on some HPC
N = feature('NumCores');
end
end
Related: Python CPU count