clear; clc;

spmd
% build magic squares in parallel
    q = magic(labindex + 2);
end

spmd
    a = (labindex - 1) / numlabs;
    b = labindex / numlabs;
    results = integral(@target, a, b);
    fprintf('Subinterval: [%-4g, %-4g]\n', a, b);
end
sum([results{:}])
integral(@target, 0, 1)

result2 = cell(10, 1);
parfor i = 1 : 10
    result2{i} = randi(100, 3, 3);
end