필터 지우기
필터 지우기

How to retrieve Toggle Button value during SPMD

조회 수: 1 (최근 30일)
Niccolò de Cesare
Niccolò de Cesare 2016년 10월 2일
댓글: Walter Roberson 2016년 10월 4일
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ò

답변 (2개)

Walter Roberson
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.

Roman Müller-Hainbach
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
Niccolò de Cesare
Niccolò de Cesare 2016년 10월 4일
Ok this is a good idea! But after if i want write the output (for example on one worker i put a timer() function that every second give me the elapsed time) into a GUI textLabel can i do it?
Because i've developed an app that controls a servo-motor (servo-motor pulse with a set pause by user) and i would like to that at the same time another script called timer() calculate the elapsed time and write it on a label into the GUI every second; in fact pause of timer() is always the same but not the servo's pause, thus i thought that the parallel toolbox works fine for that but i don't know how interact with the GUI during SPMD.
Walter Roberson
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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by