필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Question on a simple "parfor loop"

조회 수: 1 (최근 30일)
harry wang
harry wang 2015년 11월 23일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi There,
I have a simple parfor loop as belows
c=1;
a=0;
parfor i=-90:90
c=i+91;
a(c)=3;
end
I thought in this way, each iteration is independent and satisfy the rule of parallel computing, but i still get an error message " The variable a in a parfor cannot be classified". Any one could let me know the reason and how to fix the code?
Thanks.

답변 (1개)

Walter Roberson
Walter Roberson 2015년 11월 24일
parfor i=-90:90
a(i+91)=3;
end
The parfor index variable must appear directly in the indexing expression, not as a variable computed based upon the indexing expression. This is a limitation on parfor to allow it to do static analysis.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by