How to search for an exact string not just contains
55 ビュー (過去 30 日間)
古いコメントを表示
Hiyah
I'm searching a cell array for an exact string, e.g the data I am searching contains both 'Las Vegas, NV' and 'North Las Vegas, NV' and I want specifically the coordinats of 'Las Vegas, NV'
the code I've used so far is:
Y = ~cellfun('isempty',strfind(cellstr(num),'Las Vegas, NV'));
(then [row col] = find(Y==1) )
how do I modify?
Thanks alot !
0 件のコメント
回答 (2 件)
the cyclist
2020 年 9 月 12 日
編集済み: the cyclist
2020 年 9 月 12 日
loc = {'Las Vegas, NV','North Las Vegas, NV'};
match = strcmp(loc,'Las Vegas, NV')
4 件のコメント
Walter Roberson
2020 年 9 月 12 日
I'm searching a cell array for an exact string
Use ismember()
7 件のコメント
Walter Roberson
2020 年 9 月 12 日
X = ismember((num),a));
1 1 0
2 -1
Count your open brackets.
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!