필터 지우기
필터 지우기

parfor loop variable classification

조회 수: 1 (최근 30일)
Quentin
Quentin 2014년 8월 31일
편집: Adam 2014년 9월 1일
Hi all,
I have always had trouble getting parlor loops to work for me, and again I'm having a variable classification issue. The code is for a machine vision program that we are using to detect blobs in multiple behavioral chambers in a video. We would basically like to use a parfor loop to find the blobs in each frame more rapidly. We'll track them across frames later. This way it would seem like if we built a small computer cluster, we could speed up the code a lot. Basically this is what we are trying to do with several of our variables (I've shown only one for an example).
recordAValue = NaN(blobsPerChamber, numberOfChambers, numberOfFrames);
parfor g = 1:numberOfFrames
load(frame);
for k = 1:numberOfChambers
findBlobs
for j = 1: blobsPerChamber
recordAValue(j,k,g) = someCalculation;
end
end
end
The error that I would get is that recordAValue cannot be classified. I've looked at the documentation but I still can't make sense of it. The loops all seem independent to me and the matrix recordAValue should be able to be generated one loop at a time.
Any help is appreciated. Thanks in advance.
  댓글 수: 2
Edric Ellis
Edric Ellis 2014년 9월 1일
Hm. The following simplified example works for me:
out = NaN(6, 5, 4);
parfor idx = 1:4
for jdx = 1:5
for kdx = 1:6
out(kdx, jdx, idx) = 7;
end
end
end
What version of MATLAB are you using?
Adam
Adam 2014년 9월 1일
편집: Adam 2014년 9월 1일
What are 'someCalculation' and 'findBlobs' and where/how are they defined? They may be breaking transparency rules for parfor loops as they could theoretically be anything as it is currently stated.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by