I have a problem in I parallelize my matlab code,

Hello everyone
I use the parfor loop to parallelize my code here is the message that is displayed:"The temporary variable val in a parfor is uninitialized."

댓글 수: 4

Jan
Jan 2021년 7월 30일
Please post the relevant part of the code, preferrably a minimal working example, and a copy of the complete error message.
parfor (i = 1:k,5)
members = (i == idx);
disp(strcat('Cluster numero <',num2str(i),'>'));
sousEns=Pts(members,:);
if(isempty(sousEns)==1)
continue
end
sousRay=Ray(members);
disp('De Centroid');
disp(C(i,:));
Echan=[];
for j = 1:size(sousEns,1)
xx=[];
yy=[];
zz=[];
xx=sousRay(j)*sin(phi).*cos(theta)+sousEns(j,1);
yy=sousRay(j)*sin(phi).*sin(theta)+sousEns(j,2);
zz=sousRay(j)*cos(phi)+sousEns(j,3);
% disp('OOOKKKKK')
n=size(xx(:),1);
Echan2=[];
Echan2(1:n,1)=xx(:);
Echan2(1:n,2)=yy(:);
Echan2(1:n,3)=zz(:);
Echan=[Echan2;Echan];
[xu,yu,zu] = sphere;
x = xu*sousRay(j) + sousEns(j,1);
y = yu*sousRay(j) + sousEns(j,2);
z = zu*sousRay(j) + sousEns(j,3);
c = ones(size(z))*1;
hold on;
surf(x,y,z,c);
end
end
here is the error: Use addAttachedFiles(pool, files) to specify the required files to be attached.
here is the error message:
An UndefinedFunction error was thrown on the workers for 'mex'. This might be because the file containing 'mex' is not
accessible on the workers. Use addAttachedFiles(pool, files) to specify the required files to be attached. See the
documentation for 'parallel.Pool/addAttachedFiles' for more details.
excuse me as I often respond late. I do not yet understand how the forum looks

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by