フィルターのクリア

clear plot and add a new plot to the current figure

4 ビュー (過去 30 日間)
negin tebyani
negin tebyani 2018 年 2 月 27 日
コメント済み: KL 2018 年 3 月 1 日
I have a plot that I am showing it in figure 1. and also an iteration of 10 times
RRHcoo_x=[-560,-280,0,280,560,-560,-280,0,280,560,-560,-280,0,280,560,-560,-280,0,280,560]
RRHcoo_y=[-520,-170,200,530,-520,-170,200,530,-520,-170,200,530,-520,-170,200,530,-520,-170,200,530]
hold on;
X_length=length(RRHcoo_x);
figure(1)
for nn=1:X_length
x=RRHcoo_x(nn);
y=RRHcoo_y(nn);
plot(x,y,'-mo',...
'LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[.49 1 .63],...
'MarkerSize',7);
end
axis([-700 700 -700 700]);
I have some points that should stay fixed in the plot and in each iteration some points should change place. the points that I have indicated in the code above, should stay in their place, but the points in the code below, change place in each iteration:
a=-700;
b=700;
usercoo_x = a + (b-a).*rand(1,numberofusers);
usercoo_y = a + (b-a).*rand(1,numberofusers);
X_length=length(usercoo_x);
for nn=1:X_length
x=usercoo_x(nn);
y=usercoo_y(nn);
figure(1)
plot(x,y,'--ro','LineWidth',2,'MarkerSize',4);
end
axis([-700 700 -700 700]);
when I run this code, the new iteration points are added to the previous iteration points. what I need is to clear only the points of the second plot in figure 1, and the points on new iteration should be added instead. what should stay fixed, is the points in the first plot. how can I do this in matlab?

回答 (1 件)

KL
KL 2018 年 2 月 27 日
You probably want to use clf
f = figure(1)
plot something
clf(f)
plot something else
  2 件のコメント
negin tebyani
negin tebyani 2018 年 2 月 27 日
when I use clf, it clears the whole plot
KL
KL 2018 年 3 月 1 日
Ah okay, I think I understand what you're trying to do here. You should probably store your iteration results in a matrix (column wise) and ignore/delete the columns you don't want and plot again the matrix.

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

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by