Using parfor in matlab for nested loops

matlab

Solution

In MATLAB, `parfor` cannot be nested. Which means, in your code, you should replace one `parfor` by a `for` (the outer loop most likely). More generally, I advise you to look at this tutorial on parfor.

Problem

I want to parallelize block2 for each block1 and parallerlize outer loop too. previous code: ``` for i=rangei <block1> for j=rangej <block2> dependent on <block1> end end ``` changed code: ``` parfor i=rangei <block1> parfor j=rangej <block2> dependent on <block1> end end ``` how much efficient can this get and will the changed code do the right thing? Is the changed code valid for my requirements?

Original source