clear all
N=20;
area=100;
hold on;
for i=1:N
hplot(i)=plot(X(i),Y(i));
htext(i)=text(X(i),Y(i),num2str(i),'fontsize',10);
hold on;
end
I wish to clear the plotted node after pause(.1) only plotted nodes clear and not clear the N,XX,YY,BS,area and plotted bs after pause(.1)

 採用された回答

Michael Haderlein
Michael Haderlein 2015 年 4 月 22 日

0 投票

delete(hplot)

4 件のコメント

singh
singh 2015 年 4 月 22 日
Michael thanks but some problem are there after deleted range of the coordinates are change but i have required only static range of X and Y. can u give me suggestion to solve this problem. see in the figure below..
Michael Haderlein
Michael Haderlein 2015 年 4 月 23 日
Ok, you figured out that you need to apply the command also on the text - good. Another hint, maybe you can show the position of the points better by using markers. Just change the plotting to plot(X(i), Y(i), 'x'). Also, the hold on in the inner loop is not necessary.
But now, what is the problem? Should the red circle and the BS also be deleted? Then you need to also save their handles and delete them as well. Or do you want the scale limits to remain at [0 area]? Just set them so, by
xlim([0 area]), ylim([0, area])
If none of these points addresses your problem, please explain it again.
singh
singh 2015 年 4 月 23 日
now code is working because BS plot in the under of first loop... but michael if i am not used htext,hplot or any other variable then how to delete all every loop tym...
Michael Haderlein
Michael Haderlein 2015 年 4 月 23 日
If you want to delete everything plotted in the axes, use
delete(get(gca,'children'))

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGraphics Objects についてさらに検索

タグ

質問済み:

2015 年 4 月 22 日

編集済み:

2015 年 4 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by