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

12 ビュー (過去 30 日間)
Patrick
Patrick 2012 年 3 月 9 日
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
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 ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by