MATLAB: How to run multiple m-files parallelly in MATLAB

parallel computing

I wonder how to run multiple m-files (e.g. file01.m, file02.m, file03.m, … , file100.m) parallelly in MATLAB installed in Linux server. The following is part of my code:
for i in {1..100}; do( matlab -nodisplay < file${i}.m wait )& done wait

Best Answer

If you have Parallel Computing Toolbox, you could do something like this (presuming each file##.m contains a function):
files = dir('file*.m');
filenames = {files.name};
parfor idx = 1:numel(filenames)
[~, fcn] = fileparts(filenames{idx});
out{idx} = feval(fcn);
end