The PARFOR loop cannot run due to the way variable 'm' is used

조회 수: 1 (최근 30일)
Ali Al-Saegh
Ali Al-Saegh 2020년 9월 4일
댓글: Ali Al-Saegh 2020년 9월 4일
Matlab shows "The PARFOR loop cannot run due to the way varialbe 'm' is used".
Please, how to parallelize both of the loops.
m=1;
for iClss = 1:nuClasses
for iTry = 1:nuTrials
fCreateFiless(cTrials{iTry,iClss}', iClss, parentFolder, m, samFreq);
m=m+1;
end
end

채택된 답변

Matt J
Matt J 2020년 9월 4일
편집: Matt J 2020년 9월 4일
parfor m=1:nuClasses*nuTrials
[iTry,iClss]=ind2sub(size(cTrials),m);
fCreateFiless(cTrials{iTry,iClss}', iClss, parentFolder, m, samFreq);
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by