Hi, could you help me please in solving this problem? I need to use parfor and at the same time the function simuconf inside parfor uses global variables. I have read other similar questions but I haven't been able to find a solution. Thanks a lot!
B=7; coeffconfidsimple=randn(200,2);cutoffcoeffs=size(coeffconfidsimple,1);temp=zeros(B,201);parfor w=1:B mstr=num2str(w); A=load(['subdata' mstr '.mat']); %At each iteration I load subdata(w)
E=load(['freq' mstr '.mat']); %and freq(w) and I have to transform them in
%numerical arrays
C= struct2cell(A); D= struct2cell(E); global subdata global freq subdata= cell2mat(C); freq=cell2mat(D);compare=zeros(cutoffcoeffs,1); for x=1:cutoffcoeffs [compare(x)]=simuconf(coeffconfidsimple(x,:)'); %This function uses
%subdata and freq
%at each iteration
endtemp(w,:)=[w ((compare)*size(subdata,1))']; end
Best Answer