I'd definitely omit the header "close all;
fig=figure(1);". It is not useful to close other figures from here and the hard-coded figure handle 1 is not secure. Better use an non-integer handle to avoid collisions with other figures.
Creating the display in each timer callback completely, it would take much less processing time to update only the changed elements. Simply store the handles of the created objects in the TIMER's UserData and update the XData and YData of the PATChas well as the String property of the text showing the current time.
I'd definitely omit the header "close all;
fig=figure(1);". It is not useful to close other figures from here and the hard-coded figure handle 1 is not secure. Better use an non-integer handle to avoid collisions with other figures.
Creating the display in each timer callback completely, it would take much less processing time to update only the changed elements. Simply store the handles of the created objects in the TIMER's UserData and update the XData and YData of the PATChas well as the String property of the text showing the current time.
Comment only