Stop interrupt button & delete line from graph error at GUI

2 views (last 30 days)
Hi. The link below is the snapshot of my GUI.
The error appears when I pressed "Stop" or "Reset" to stop the yellow needle from moving at the graph. Below is the error message from the MATLAB command windows: ??? Error using ==> delete Invalid handle object.
Error in ==> placeT at 164 delete(PPIline)
Now I suspect the error comes from "Generate" button, "Stop" button, or "placeT" callfunction. Below are the snippet of my codes for the 3 functions above:
This is the "Generate Target" button
function genTarget_Callback(hObject, eventdata, handles)
% initialize the flag variable
set(handles.genTarget, 'UserData', 0);
% While the flag variable is zero, the loop continues
while( get( handles.genTarget, 'UserData' ) == 0 )
circlev2(handles.realTarget,handles.range); % print target on real target
placeT( ...);
handles.btndown = 0;
placeT( ...);
drawnow
end
This is the "Stop" button
function simStop_Callback(hObject, eventdata, handles)
% toogle the flag variable to stop other processes.
set( handles.genTarget, 'UserData', 1);
guidata( hObject, handles );
This is the placeT function
function placeT( display, h, tgMx, range , btndown, emp, NoMx)
.....
PPIline = plot(h.radarDisplay, X, Y, 'Color', 'y' );
....
pause(0.01);
delete(PPIline)
I have tried the interrupt method, in which when the Stop button is press, the "handles.genTarget" is set to "1" and it will cause the yellow needle stop moving, but it did not work.
Was it due to my interrupt method is wrong? Or I have used the wrong way to delete the line?
Any advice is much appreciated. Thanks and Happy New Year.

Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!