How to retrieve Toggle Button value during SPMD
1 回表示 (過去 30 日間)
古いコメントを表示
Hi everyone,
i've a problem, i want launch two parallel while-cycles with SPMD, however i want stop them not when they finish but when the Toggle Button value is 1. If the SPMD isn't the right way, there's another way to execute parallel function and stop them with Toggle Button?
Thanks, Niccolò
0 件のコメント
回答 (2 件)
Walter Roberson
2016 年 10 月 3 日
spmd sessions cannot interact with graphics, and there is no non-spmd thread that is in control that could handle the graphics.
You might be able to use parfeval() instead; see https://www.mathworks.com/matlabcentral/answers/114033-waitbar-in-a-spmd-block-in-a-gui
0 件のコメント
Roman Müller-Hainbach
2016 年 10 月 4 日
A workaround for sharing information across multiple threads of execution is using your file system. Write the toggle button status in a file on your hard drive. Then each SPMD branch can read that file.
2 件のコメント
Walter Roberson
2016 年 10 月 4 日
When you are using SPMD, you cannot get at the current toggle button status. There is no lab that is defined as assigned to the original hardware, and there is no non-lab thread that is defined as being left running.
I have not tested graphics callbacks under the situation, but graphics callbacks are defined to happen only at boundaries of pause() or drawnow() or waitfor() or a figure being made active, and none of those can happen in the same thread when SPMD is running.
If there is any potential it would have to be through timer callbacks, as those are defined to be able to interrupt in some other circumstances as well.
参考
カテゴリ
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!