How to delete plot among many plot in figure

1 回表示 (過去 30 日間)
Akshay M
Akshay M 2017 年 2 月 20 日
回答済み: Akshay M 2017 年 3 月 8 日
I have a loop which captures image, finds boundaries and plots lines around them. In each iteration, I want to clear previously plotted all the boundaries and plot new boundaries. I am using command [B,L] = bwboundaries(bw,'noholes'); to identify boundaries. To plot lines on figure, hold on for i = 1:length(B) plot(B{i}(:,2), B{i}(:,1), 'r', 'LineWidth', 2.5) end To delete previously plotted line in next iteration I am using if isgraphics(hPlotData) delete(hPlotData); end when 'B' is a cell of 1x1, delete(hPlotData) works perfectly and deletes plotted lines, however, when 'B' is cell of multiple doubles(example B: 9x1 cell), delete(hPlotData) doesn't delete any of the previously plotted boundary.

回答 (1 件)

Akshay M
Akshay M 2017 年 3 月 8 日
Thank you for reply.
I am using insertMarker and insertText now.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by