parallel computing // how to use parfor

1 view (last 30 days)
kyoung won Min
kyoung won Min on 3 Dec 2020
Answered: Pranav Verma on 11 Dec 2020
My code is as below. But error occurs.
("Solve Variable Classification Issues in parfor-Loops" )
I don't know why error occur.
How to solve it??
%% definition of variables
nov = 30 ;
nov_down = -512 ;
nov_up = 512 ;
iter = 5000 ;
nohm = 4 ;
HMCR_down = 0.8 ;
HMCR_up = 1 ;
PAR_down = 0.2 ;
PAR_up = 0.4 ;
bw_down = 0.01 ;
bw_up = 1 ;
runn = 1 ;
HMS = 15 ;
initial=xlsread('HMS15,nov30,-512,512.xlsx');
HM=zeros(nohm,HMS,nov);
parfor i = 1:nohm
HMCR(i) = round(HMCR_down + (HMCR_up-HMCR_down)*rand,2) ;
PAR(i) = round(PAR_down + (PAR_up-PAR_down)*rand,2) ;
bw(i) = round(bw_down + (bw_up-bw_down)*rand,2) ; ;
virtual=zeros(HMS,nov);
virtual(1:HMS,1:nov)=initial;
HM(i,1:HMS,1:nov)= virtual ;
end

Answers (1)

Pranav Verma
Pranav Verma on 11 Dec 2020
Hi kyoung,
Please provide with error and your .xls file so that we can reproduce the error.
In the meanwhile, you can go through the Problem with parfor classified variable and see if it helps.
Thanks

Categories

Find more on Parallel for-Loops (parfor) 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!