MATLAB: How to run two matlab scripts in parallel

Parallel Computing Toolboxtwo scripts in parallel

I need to run two scripts in parallel and simultaneously, run the first script and the second script at the same time.

Best Answer

You can use parfor to run two functions simultaneously. Eg:
funcs1 = {@fun1, @fun2} ; % let fun1, fun2 be two functions
arguments = {inp1,inp2 ;inp1,inp2} ; % write the inputs of each function
solutions = cell(1,2); % initialize the solution
% use of parfor
parfor ii = 1:2
solutions1{ii}=funcs1{ii}(arguments1{ii,:});
end
M = solutions1{1} ; N = solutions1{2} ; % assign the results