% This code creates a random 4x4 matrix with values between 0 and 10, n times. n = 4; % Should correspond to --cpus-per-task in the sbatch file. parpool('local', n); parfor i=1:n % Multithreaded part disp(round(rand(4)*10)); end