How to keep rows including a specific name in structure and remove everything else within the structure?
10 ビュー (過去 30 日間)
古いコメントを表示
Wolfgang McCormack
2021 年 3 月 13 日
回答済み: Walter Roberson
2021 年 3 月 14 日
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?
1 件のコメント
Jan
2021 年 3 月 14 日
Please post a short example of how your data look like. I do not understand "One of its columns is character type. chr." Structs do not have "columns".
採用された回答
Walter Roberson
2021 年 3 月 14 日
placenames = {YourStruct.PlaceNameField};
wanted_mask = ismember(placenames, {'Malta', 'Paraguey', 'Lake Wawa'});
selected_members = YourStruct(wanted_mask);
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Other Formats についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!