Hey!
I just came across this and I don't quite understand it. Why is MATLAB complaining about dependencies in different loop iterations when I do something like this:
%minimum working example:
a = cell(100,2);%fill first row with values;
a(:,1) = {ones(1,1)};%c = a;
parfor i=1:size(a,1) b = a{i,1}(1) + 2; a{i,2} = b;end
Why can't I read the row I am working on prior to writing in it? I am using the same i every time… Do I really have to copy the whole array to c and read from that to run this parallel?
Thank you!
Best Answer