Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
The variable in parfor cant classified
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello.This is my code:
c_hat = zeros(n,1);
vc = zeros(m,n);
cv = zeros(m,n);
parfor j = 1:n
checks = find(H(:,j));
allIncoming = cv(checks,j);
sumAllIncoming = sum(allIncoming) + LLRs(j);
c_hat(j) = (1 - sign(sumAllIncoming))/2;
toCheck = sumAllIncoming - allIncoming;
vc(checks,j) = toCheck;
end
It is not runing because "The variable vc in a parfor cannot be classified." Without parfor it is running fine. Is it possible to run it with parfor?
댓글 수: 0
답변 (1개)
Matt J
2013년 7월 4일
편집: Matt J
2013년 7월 4일
There are rules about sliced variables and how you can index them in parfor loops. However, you can get around these rules by re-organizing vc and cv as cell arrays,
c_hat = zeros(n,1);
vc = num2cell(zeros(m,n),1);
cv = vc;
parfor j = 1:n
checks = H(:,j)~=0;
allIncoming = cv{j}(checks);
sumAllIncoming = sum(allIncoming) + LLRs(j);
c_hat(j) = (1 - sign(sumAllIncoming))/2;
toCheck = sumAllIncoming - allIncoming;
vc{j}(checks) = toCheck;
end
vc=[vc{:}]; %convert back to normal array
댓글 수: 7
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!