poolobj = parpool(8);
spmd
    msg = sprintf('Hello world from process %d of %d', labindex, numlabs);
end

for i=1:poolobj.NumWorkers
    disp(msg{i});
end
delete(poolobj);
