how to write a programme in matlab comparing USA states name with english alphabets, and give the unmatch letter Q as a output.. ?
2 ビュー (過去 30 日間)
古いコメントを表示
prabakaran arumugam
2020 年 2 月 9 日
コメント済み: prabakaran arumugam
2020 年 2 月 11 日
how to write a programme in matlab comparing USA states name with english alphabets, and give the unmatch letter Q as a output.. ?
0 件のコメント
採用された回答
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 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!