フィルターのクリア

parfor. Error: The variable eavg in a parfor cannot be classified.

2 ビュー (過去 30 日間)
Marco Castelli
Marco Castelli 2014 年 12 月 2 日
コメント済み: Mohammad Abouali 2014 年 12 月 3 日
I have already read other topic on Errors and parfor but i don't find the answer to my problem.
My code give me an Error: "Error: The variable eavg in a parfor cannot be classified."
The pice of code with parfor is:
eavg = zeros(size(coeff_d,2),size(coeff_c,2),size(f,1));
parfor i0 = 1:size(vett,2)
i1 = vett(1,i0);
i2 = vett(2,i0);
i3 = vett(3,i0);
if curva~=2
if curva==4
z_rel = (i3-1)/(size(y,1)-1);
newcoeff = (-1.817*(z_rel)^2+2.776*z_rel)*0.7;
else
newcoeff = coeff_c(i2);
end
suptemp = EsponenzialeSingola(y(i3,:), f(i3,:),...
coeff_d(i1), newcoeff, plottacurve);
else
eavg(i1,i2,i3) = EsponenzialeDoppia(y(i3,:), f(i3,:),...
coeff_d(i1), coeff_c(i2), plottacurve);
end
end
the variables coeff_c, coeff_d, f, coeff_c, vett, curva, y and plottacurva are declared befor parfor-loop.
Can you help e to fix the Error?

採用された回答

Mohammad Abouali
Mohammad Abouali 2014 年 12 月 2 日
your parfor is based on i0 eavg is not being sliced by that.
So it doesn't know how to slice eavg and then once it comes out of parfor it doesn't know how to combins it.

その他の回答 (1 件)

Marco Castelli
Marco Castelli 2014 年 12 月 3 日
編集済み: Marco Castelli 2014 年 12 月 3 日
@Mohammad Abouali : Thanks to you help I solve the problem in this way:
parfor i0 = 1:size(vett,2)
if curva~=2
if curva==4
z_rel = (vett(3,i0)-1)/(size(y,1)-1);
newcoeff = (-1.817*(z_rel)^2+2.776*z_rel)*0.7;
else
newcoeff = coeff_c(vett(2,i0));
end
eavg(i0) = EsponenzialeSingola(y(vett(3,i0),:), f(vett(3,i0),:),...
coeff_d(vett(1,i0)), newcoeff, plottacurve);
else
eavg(i0) = EsponenzialeDoppia(y(vett(3,i0),:), f(vett(3,i0),:),...
coeff_d(vett(1,i0)), coeff_c(vett(2,i0)), plottacurve);
end
end

カテゴリ

Help Center および File ExchangeParallel for-Loops (parfor) についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by