parallel_function error, "V must be a 3-D array"
조회 수: 7 (최근 30일)
이전 댓글 표시
Hi all, I'm trying to parallelize some of my code, and I have no idea how to fix this error. Here's the code:
energy=zeros(length(epsilon_theta),length(epsilon_r));
Emag=zeros(length(epsilon_theta),length(epsilon_r),21);
parfor m=1:length(epsilon_theta)
energy1=zeros(length(epsilon_r));
Emag1=zeros(length(epsilon_r),21);
for n=1:length(epsilon_r)
[energyf, Emagf, Source_Emag]=DDA_ExpRf_fun([epsilon_theta(m) epsilon_r(n)]);
energy1(n)=energyf;
Emag1(n,:)=Emagf;
end
energy(m,:)=energy1;
Emag(m,:,:)=Emag1;
end
When I run it, parfor breaks and returns
??? Error using ==> parallel_function at 598 Error in ==> interp3>linear at 320 V must be a 3-D array.
Does anyone know what could be the problem? Thanks! I'm totally new to parallel computing. Any other general tips on optimizing would be great as well.
댓글 수: 1
Edric Ellis
2012년 3월 9일
Do thinks work correctly with MATLABPOOL closed? Do they work correctly with a FOR loop instead of a PARFOR loop? I presume your code in DDA_ExpRf_fun is calling interp3 - perhaps you should add some error checking that your variables are the correct size when you get there.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!