Hello! How can i delete a line from my figure?

20 次查看(过去 30 天)
Hello! I have an image from which i would like to delete a line. How can i do that? When i use the delete() function it does not work. There is no error mentioned nor is the image changing.
Please help!

采纳的回答

Image Analyst
Image Analyst 2019-12-28
This should work
hLine = line(x, y, 'Color', 'r', 'LineWidth', 2);
% Now delete it.
delete(hLine);
  9 个评论
Walter Roberson
Walter Roberson 2019-12-29
Yes, recording the handle will always be a better solution rather than findobj when it can be done. Sometimes though you are wanting to delete a line from a plot created by code you do not have control of, or from a stored fig that you cannot change the generation code for, and in those cases you would use findobj or findall

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Properties 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by