slicing flag with parfor, cannot identify error
조회 수: 16 (최근 30일)
이전 댓글 표시
MatLab flagged an error in my parfor loop. The error is roughly 'valid indices are restricted in parfor loops'. Have read the sliced variables documentation and cannot determine the problem. Similar code and my attempted diagnosis follow.
N=10;
M=20;
DTc = zeros(M,2,2);
DTcs1 = zeros(M,N);
DTcs2 = zeros(M,N);
parfor kIter = 1:M
DT = eye(2);
DTs = reshape(repmat(eye(2),[N,1]),[N,2,2]);
DTc(kIter,:,:) = DT; %flagged
DTcs1(kIter,:) = DTs(:,1,1); %flagged
DTcs2(kIter,:) = DTs(:,2,2); %flagged
end
I read the documentation and DTc, DTcs1 and DTcs2 seem to fit the four characteristics of sliced variables.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!