clear single plots intead of the whole plot

2 ビュー (過去 30 日間)
Johan
Johan 2011 年 6 月 16 日
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

採用された回答

Arturo Moncada-Torres
Arturo Moncada-Torres 2011 年 6 月 16 日
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!

その他の回答 (2 件)

Gerd
Gerd 2011 年 6 月 16 日
Hi Johan,
on a simple plot you would write
a=linspace(0,10,1000);
b=sin(a);
c=cos(a);
h1 = plot(a,b);
hold
h2=plot(a,c,'r');
to remove the first plot simply
delete(h1);
So if you keep the handle of your dots you can simply remove them
Gerd

Johan
Johan 2011 年 6 月 16 日
Thanks! :)
  1 件のコメント
Arturo Moncada-Torres
Arturo Moncada-Torres 2011 年 6 月 16 日
Our pleasure ;)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by