How to search for an exact string not just contains
246 次查看(过去 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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!