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 CenterFile Exchange에서 Parallel Computing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by