categorica​lデータから部分一致​する行を特定したい

2 vues (au cours des 30 derniers jours)
YI
YI le 12 Avr 2019
Réponse apportée : Kazuya le 12 Avr 2019
categoricalデータから特定の文字列が部分一致する行を特定するにはどうすればよいでしょうか。

Réponse acceptée

Kazuya
Kazuya le 12 Avr 2019
一案ですが、いったん string 型に変更して contains 関数で見つける方法ではどうですか?R2016b 以降の MATLABである必要がありますが・・。
Stations = {'S1';'S2';'S1';'S3';'S2'};
Stations = categorical(Stations)
strStations = string(Stations)
idx = contains(strStations, "1"); % 1 を含むデータを検索
Stations(idx)

Plus de réponses (0)

Catégories

En savoir plus sur 数値型 dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!