フィルターのクリア

how apply parfor for this code

2 ビュー (過去 30 日間)
omar A.alghafoor
omar A.alghafoor 2020 年 10 月 15 日
コメント済み: omar A.alghafoor 2020 年 10 月 15 日
Hi friends ....
i try apply parfor for my code but appear note " the parfor loop cannot run........"
Are there any solution?
This code:
lfSeed = '11001011';
lfPrev = lfSeed;
lfsrKey = uint8(zeros(m, n));
parfor i=1:m
for j=1:n
%LFSR Sequence
lfPrev = strcat(lfPrev(2:8), num2str(xor(str2double(lfPrev(1)), xor(str2double(lfPrev(5)),....
xor(str2double(lfPrev(6)), str2double(lfPrev(7)))))));
lfsrKey (i, j) = bin2dec(lfPrev);
end
end
lfsrKey (:,:, 2)=lfsrKey (:,:, 1);
lfsrKey (:,:, 3)=lfsrKey (:,:, 1);
toc;

回答 (1 件)

Matt J
Matt J 2020 年 10 月 15 日
編集済み: Matt J 2020 年 10 月 15 日
No, parfor cannot be applied here. Your loop iterations are not parallel because lfPrev depends on previous iterations.
  1 件のコメント
omar A.alghafoor
omar A.alghafoor 2020 年 10 月 15 日
thank you bro

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by