Borrar filtros
Borrar filtros

How to control button in GUI Start and Stop process

10 visualizaciones (últimos 30 días)
when I press stop button process is stop all and when press start button again process is begin again
  1 comentario
Gopichandh Danala
Gopichandh Danala el 20 de Jun. de 2017
provide more details, we don't understand like what to start or stop lot of assumptions

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 20 de Jun. de 2017
Editada: Walter Roberson el 20 de Jun. de 2017
There is no way to use the GUI to interrupt a routine without its cooperation.
Your stop_Callback should set a value in a shared area. Your realtimefunction routine should sometimes fetch the current version of the value, and exit if it finds it has been asked to stop.
For example,
function start_Callback(hObject, eventdata, handles)
set(hObject, 'UserData', false);
realtimefunction(handles);
function stop_Callback(hObject, eventdata, handles)
set(handles.start, 'UserData', true);
function realtimefunction(handles)
...
while true
drawnow(); %give a chance for interrupts
need_to_stop = get(handles.start, 'UserData');
if ~isempty(need_to_stop) && need_to_stop;
break;
end
...
end
%now clean up as needed
  9 comentarios
Walter Roberson
Walter Roberson el 20 de Jun. de 2017
That is not what the comments say. As you inform me that you are having problems executing the code, I must presume that the comments describe the way that the code is intended to operate and that any code that does not work that way is incorrect code that you were asking me to repair.
In any case you can easily remove the test I put in about framecount < 100
Zeljko Tomicevic
Zeljko Tomicevic el 13 de En. de 2018
Hello,
Have the same problem but I did not catch nothing from above. Where I can read more about starting and stopping real time functions in APP designer?
Best

Iniciar sesión para comentar.

Más respuestas (1)

Pathasu Doungmala
Pathasu Doungmala el 1 de Mzo. de 2019
try,
close all;

Categorías

Más información sobre Graphics Performance en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by