필터 지우기
필터 지우기

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일)
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 CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by