Pressing the button changes position only once
I have a question about callback functions in MATLAB GUIDE. When the button is clicked, the following code is executed:
handles.xPos=handles.xPos+1
addX = handles.xPos
handles.shape2 =fill ([-2+addX 1+addX 1+addX -1+addX], [1 1 -1 -1], 'r');
This works, but only once (and the old form still exists, but that's a separate issue). I ran the debug code and determined that the callback function is always called when the button is pressed, but for some strange reason there is no effect in changing the position after the first button click.
What am I doing wrong here?
+3
source to share