How to nest multiple parfor loops
parfor is a convenient way to distribute independent iterations of intensive computations among several "workers". One meaningful restriction is that parfor -loops cannot be nested, and invariably, that is the answer to similar questions like there and there . Why parallelization across loop boundaries is so desirable Consider the following piece of code where iterations take a highly variable amount of time on a machine that allows 4 workers. Both loops iterate over 6 values, clearly hard to share among 4. for row = 1:6 parfor col = 1:6 somefun(row, col); end end It seems like a good idea to