How to keep rows including a specific name in structure and remove everything else within the structure?

6 次查看(过去 30 天)
Hi all,
I have a shape file (shp) that is read as a structure within MATLAB. It is a 2540x1 struc in the worksapce. One of its columns is character type. chr. I want to find a few names in it like 'Malta', keep the entire row that includes the Malta and then remove all other rows. Could you please teach me how to do that?

采纳的回答

Walter Roberson
Walter Roberson 2021-3-14
placenames = {YourStruct.PlaceNameField};
wanted_mask = ismember(placenames, {'Malta', 'Paraguey', 'Lake Wawa'});
selected_members = YourStruct(wanted_mask);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by