Stop an infinit function that is running in parallel with the remaining code, and get the outputs
2 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone,
I am looking for a way to retrieve the output of a function that is running in parallel (with the function parfeval for example) and that can run indefinitely if we don't stop it in the remaining code.
For example : This could be the function :
function a = infinit()
go = true ;
while go
a = 1 ;
end
end
and this is the code :
parpool(1) ;
f = parfeval(@infinit,1) ;
% looking for the code line that can stop the function,
value = fetchOutputs(f) ;
I know that "cancel" can actually stop, but then we can't get the output. I have also tryed by using a global variable, or a public variable with app designer, but both of those way are not working. From my research so far, it seems there is no solution. But still I hope that someone has maybe found an idea ! ;)
Otherwise, I actually want to run a function in app designer that is reading data from a sensor periodically. Meanwhile the code is doing something else until the user has finished the experiment. Then I want to get the data from the function. I guess maybe there might be a workaround ?
I thank you all in advance for your help !
Thomas
0 件のコメント
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!