Filter löschen
Filter löschen

Do MATLAB GUI buttons create parallel strands if pressed multiple times?

1 Ansicht (letzte 30 Tage)
So i have a GUI with a button to gather data from a USB device. when pressed the button triggers a sequential code to recover data from the device.
My question is, could multiple presses trigger multiple instances of the same code to run either deliberately or through the absence of a particular code to prevent it?
If so, and it affects the displayed figure, which process has priority?
Thanks,
Jason

Antworten (2)

Walter Roberson
Walter Roberson am 18 Sep. 2017
You would need to have specific use of the Parallel Computing Toolbox such as parfor() or spmd() or parfeval() in order to have multiple parallel instances of the same code.
However in some cases it is possible for a callback to suspend a different callback. See the description of https://www.mathworks.com/help/matlab/ref/uicontrol-properties.html#zmw57dd0e1042342 the Interruptible and BusyAction properties.

Jason Riley
Jason Riley am 18 Sep. 2017
Walter,
Thanks for the rapid response. So as i understand it, the second click could cause a second version of the process to interupt the first version of the process - what happens to the first version, does it terminate, or does it sit in background and await control again?
as the two are both to-ing and fro-ing over the USB bus, could this cause speed issues?
Thanks again,
Jason
  4 Kommentare
Jason Riley
Jason Riley am 18 Sep. 2017
ah, I do have a repeated call to 'drawnow' to update the figure as we go along, so its obviously picking that up as the point to subvert control. i'll check the other commands, because i am using some manufacturer code on the DAQ box as well that could cause the issue. I think this is likely my problem. I will write code to disable the button once pressed until the program has completed. i had thought it was implicit from the linear code - my mistake.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by