Hi, I'm trying to speed up my code using parfor instead of for but it doesn't work. It gives me the error: ??? Error using ==> parallel_function at 598 Error in ==> simuconf at 186 Matrix dimensions must agree. Do you have any suggestion? Thank you very much!
global n m B b rm=5; n=4; B=7; b=3; r=10;temp=zeros(B,201);load coeffconfidsimplecutoffcoeffs=size(coeffconfidsimple,1);matlabpool open 2ticparfor w=1:B mstr=num2str(w); subsubdata=load(['subdata' mstr '.mat']); subfreq=load(['freq' mstr '.mat']); C= struct2cell(subsubdata); D= struct2cell(subfreq); subdata= cell2mat(C); freq=cell2mat(D);compare=zeros(cutoffcoeffs,1); for x=1:cutoffcoeffs [compare(x)]=simuconf(coeffconfidsimple(x,:)',subdata,freq); %simuconf is a function of three arguments; in addition it uses the global variables stated at the beginning
endtemp(w,:)=[w (compare*size(subdata,1)']; endtoc
Best Answer