How to delete polyline from Drawpolyline matlab function

1 回表示 (過去 30 日間)
SatyaPrakash Gupta
SatyaPrakash Gupta 2020 年 4 月 28 日
編集済み: SatyaPrakash Gupta 2020 年 4 月 29 日
I have list of polyline drawn using drawpolyline matlab function.
the list contains nearly 500 polylines , now if i want to delete 10th polyline from the 500 polylline , how can i do it ?
Further , after deleting now the list should reduce to 499 polyline, can anyone help me please ?

採用された回答

SatyaPrakash Gupta
SatyaPrakash Gupta 2020 年 4 月 29 日
I have resolved this issue.
In drawpolyline function, we have a UserData attributes , so i use this UserData attribute to allocate each polyline with specific ID. further adding additional right click option by using "uimenu" for each polyline drawn, this option will have user define function
when this click uimenu option is selected, then collect all the attributes of the select polyline.
Now we can delete the selected polyline from the list of 500 polylline and update the table of polyline accordingly.

その他の回答 (1 件)

Geoff Hayes
Geoff Hayes 2020 年 4 月 28 日
SatyaPrakash - if you have an array of polyline objects and you want to delete the 10th item, then you could do
delete(polylineObjects(10)); % delete the polyline object
polylineObjects(10) = []; % remove the invalid polyline object from the array
The second line of code removes it from the array, reducing the array size to 499 elements.
  1 件のコメント
SatyaPrakash Gupta
SatyaPrakash Gupta 2020 年 4 月 29 日
編集済み: SatyaPrakash Gupta 2020 年 4 月 29 日
@Geoff Hayes :
This was my initial approach with the known element/index number of the polyline.
But if the user do not know which element/index has to be delected, because he can pick any random element of polyline line from 500 polyline list , then in this case how do we know which element/index of the polyline has been selected by the user ?
you can refer my above answer comment where i have resolved it.

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

カテゴリ

Help Center および File ExchangeTiming and presenting 2D and 3D stimuli についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by