How to run two parallel loops which share variables?
4 ビュー (過去 30 日間)
古いコメントを表示
ROSHITH SEBASTIAN
2020 年 3 月 23 日
コメント済み: ROSHITH SEBASTIAN
2020 年 3 月 27 日
I have to run two loops in parallel which updates an array. The loops share the array and update the values which should be available for both loops.
Pseudo code:
loop 1 : while (true)
update(add) array A
check exit condition
break
end
loop 2: while (true)
update(edit, delete) array A
check exit condition
break
end
Both the loops should run in parallel and the number of iterations of each loop depends of random variables. But the changes made in loop1 should be visible in the next iteration of loop 2 and vice versa.
Can anyone please help me with this.
0 件のコメント
採用された回答
Aditya Patil
2020 年 3 月 26 日
Explicit multiprocessing is not supported in MATLAB. Instead, you can combine the for loops into a single for loop so that the output of one is available to another.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!