if else is not working correctly inside parfor loop
Mostrar comentarios más antiguos
If I run the following piece of code using for loop, it woks fine. But when I am using the same with parfor I get an error.
Code snippet:
vhFlag = 3;
nCores = 8;
matlabpool(nCores)
parfor id = 1 : obj.patchNum
if(3 == vhFlag)
% fetch each patch from the list for matrix creation
patch = testMat(:,:,id);
else
% randomely choose a patch id
patchCounter = ceil(rand(1) * 100);
% get the corresponding patch (original or resynthesized)
patch = StimuliGeneration.GetAPatch(patchListBest, ...
patchCounter, sz-1,
vhFlag);
testMat(:,:,id) = patch; %%to test
end
mat(:, id) = patch(:);
end
matlabpool close
Error : Starting matlabpool using the 'local' configuration ... connected to 8 labs.
??? Undefined function or variable "patchListBest".
Error in => StimuliGeneration>StimuliGeneration.CreatePatchMatrix at 48
parfor id = 1: obj.patchNum
1 comentario
Edric Ellis
el 10 de Jul. de 2013
Is 'patchListBest' a function or a variable?
Respuestas (0)
Categorías
Más información sobre Parallel for-Loops (parfor) en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!