parallel computing problem in subfuction

1 view (last 30 days)
lv
lv on 17 Nov 2014
Edited: lv on 17 Nov 2014
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?

Answers (0)

Categories

Find more on Parallel Computing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!