フィルターのクリア

I have a 1x6 array X = {‘a’,’b’,’​c’,’d’,’e’​,’f’}. I want a command that returns the element of X that contains a particular string. E.g. a command that if I tell it to find ‘d

1 回表示 (過去 30 日間)
John Cadigan
John Cadigan 2022 年 9 月 16 日
編集済み: Torsten 2022 年 9 月 16 日
asking for a friend

回答 (1 件)

Torsten
Torsten 2022 年 9 月 16 日
編集済み: Torsten 2022 年 9 月 16 日
str = ["asdfsd","bfgfd","cyf","ddfhf","effdg","dgdgdf"];
pat = "d";
[~,i] = find(contains(str,pat)==1)
i = 1×5
1 2 4 5 6

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by