Grouping Plots within an Axes

2 ビュー (過去 30 日間)
HM
HM 2018 年 10 月 18 日
コメント済み: HM 2018 年 10 月 19 日
Hello, I'm using plot() to draw elements of several physical mechanisms onto a set of UIAxes. Some elements might be represented as a single line between two points, and others might be as a triangle (three points), and others might use more points. As part of my app, I need to be able to regularly delete/re-draw various groups of elements. I'm currently assigning each element to a variable e.g. Element1 = plot(Element1_x, Element1_y), so that I can later use delete(Element1) when I need to delete/re-draw it. However this process is messy, as there are dozens of elements. I'm wondering if there is a way to group up multiple plots within one variable, so that I can simply use delete(Group1) to delete a specific group of plots from my axes.

採用された回答

Kevin Chng
Kevin Chng 2018 年 10 月 19 日
Use indexing,
Element(i,num_group) = plot(Element1_x, Element1_y);
when delete all your elements in group 1,
delete(Element(:,1));
  1 件のコメント
HM
HM 2018 年 10 月 19 日
Of course! Thanks, I'll give it a try.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by