MATLAB: Clear single plots intead of the whole plot

clfMATLABplot

Hi! I'm doing a plot consisting of a "chart" and some dots coming up on it with 10 sec inteval is it possible to only erase the dots and keep the chart? right now I'm using the clf function but it clears the whole window. Johan

Best Answer

Yes, it is possible thanks to the handles. For example, try something like this:
x = 1:1 0;
figure();
plotHandles = plot(x, '.');
delete(plotHandles); % Clear the points defined by the handle.
Give it a try!