Anyone have an idea why this isn't working? I'm trying to run a parfor loop. I can do the exact same code using a simple for loop, but I need to use this with the parfor for a massive dataset.
parfor n = [1:rows]
MeanIV(n,1) = mean([LastIV(n,1); BidIV(n,1);AskIV(n,1)])
if isnan(MeanIV(n)) == 1
SubIV = dated.IV(n)
MeanIV(n,1) = SubIV
else
MeanIV(n,1) = mean([LastIV(n,1); BidIV(n,1);AskIV(n,1)])
end
dated.MeanIV = double(MeanIV)
end
I get this error " The variable MeanIV in a parfor cannot be classified."
It is most likely the line
that is the problem.
parforwill try to "slice"MeanIV, i.e. send individual rows to different workers. However, at thedatedline, you need the entirety of the array.Move the line after the
endof theparforloop, and it will work.