フィルターのクリア

how is it possible in matlab to execute more than while loops(for infinite time) in parllel

2 ビュー (過去 30 日間)
sajid javid
sajid javid 2017 年 11 月 15 日
回答済み: Jan 2017 年 11 月 15 日
Parllel processing of while loops

回答 (1 件)

Jan
Jan 2017 年 11 月 15 日
Maybe. It would take infinite time to check this.
Note that Matlab cannot know, if a loop runs infinitely or not. So the question is, if a while loop is allowed at all inside a parfor. I do not find any hints, that it is forbidden. So why not simply try it?
parfor k = 1:8
ready = false;
while ~ready
ready = rand < 0.01;
end
end
And? Does it work? Then for "infinite" you could omit changing the value of ready. If it does not work: Do you get an error message?

カテゴリ

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