필터 지우기
필터 지우기

how to write a programme in matlab comparing USA states name with english alphabets, and give the unmatch letter Q as a output.. ?

조회 수: 1 (최근 30일)
how to write a programme in matlab comparing USA states name with english alphabets, and give the unmatch letter Q as a output.. ?

채택된 답변

Image Analyst
Image Analyst 2020년 2월 9일
Not exactly sure what you're looking for but you might look at the functions contains() and strfind():
str = 'Arizona'; % Arizona is awesome! And it contains both upper and lower case A.
containsA = contains(str, 'A', 'IgnoreCase', true)
containsQ = contains(str, 'Q', 'IgnoreCase', true)
logicalA = str == 'A' % Case sensitive.
logicalQ = str == 'Q' % Case sensitive.
ALocation = strfind(str, 'A')
QLocation = strfind(str, 'Q')
In the command window, you'll see:
containsA =
logical
1
containsQ =
logical
0
logicalA =
1×7 logical array
1 0 0 0 0 0 0
logicalQ =
1×7 logical array
0 0 0 0 0 0 0
ALocation =
1
QLocation =
[]
So, does one of these do what you want? Any follow up questions?

추가 답변 (1개)

fred  ssemwogerere
fred ssemwogerere 2020년 2월 9일
you could use regexp. Refer to the link below:

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by