parallel computing problem in subfuction

1 回表示 (過去 30 日間)
lv
lv 2014 年 11 月 17 日
編集済み: lv 2014 年 11 月 17 日
I have this simple parfor code
Ne = round((E0max - E0min)/dE0);
parfor count =1:Ne
[etap, etaNzrp(count)] = shooting(E0min+(count-1)*dE0);
end
when I run in for loop, it looks just fine. But this parfor loop report an error in subfunc shooting.
function [eta, etaNz] = shooting(E)
% Shooting method
global m Eref Unef Egw bwbwbwb Egb dz Angstrom Nz hbar U e
% Conduction band nonparabolicity
mn = m .* ((1 + (E - Eref - Unef) / Egw) .* (bwbwbwb == 0) + (1 + (E - Eref - Unef) / Egb) .* (bwbwbwb == 1));
if (min(mn) <= 0)
disp('Error! Mass is negative!')
return
end
eta = zeros(1, Nz);
eta(2) = eps * dz * Angstrom;
...
...
the error appear in 'eta(2) = eps * dz * Angstrom;'
In an assignment A(I) = B, the number of elements in B and I must be the same.
How to fix it?

回答 (0 件)

カテゴリ

Help Center および File ExchangeParallel Computing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by