Я совсем новичок в Матлабе. Я использую цикл parfor для выполнения чрезвычайно трудоемкой задачи. См. фрагмент ниже. Однако я получил информацию об ошибке от Matlab. Кто-нибудь может помочь? Я прочитал документ о парфоре, но не вижу, что делать...
Спасибо.
The parfor loop cannot run due to the way variable "M" is used
The parfor loop cannot run due to the way variable "T" is used
Explanation
MATLAB runs loops in parfor functions by dividing the loop iterations into groups, and then sending them to MATLAB workers where they run in parallel. For MATLAB to do this in a repeatable, reliable manner, it must be able to classify all the variables used in the loop. The code uses the indicated variable in a way that is incompatible with classification.
parfor i=1:size(x,1)
if (ind(index(i)) == Index1)
para=lsqcurvefit(F, [M(index(i)) T(index(i))], t, SS(ind(index(i)):end,i), [0 0], [MaxiM(index(i)) maxT],options);
elseif (ind(index(i)) == Index2)
para=lsqcurvefit(F, [M(index(i)) T(index(i))], t2, SS(ind(index(i)):end,i), [0 0], [MaxiM(index(i)) maxT],options);
end
end
para
является результатом ваших вычислений. Если вы запускаете свой код в последовательном режиме, para будет перезаписываться на каждом шаге, поэтому я не понимаю, как вы можете запускать его параллельно. Как выглядит ваш последовательный цикл? - person Kleist   schedule 16.02.2013para{i}=...
- person Jonas   schedule 16.02.2013