parallel_function error, "V must be a 3-D array"

7 Ansichten (letzte 30 Tage)
Patrick
Patrick am 9 Mär. 2012
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 Kommentar
Edric Ellis
Edric Ellis am 9 Mär. 2012
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by