How to search for an exact string not just contains
166 views (last 30 days)
Show older comments
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 Comments
Answers (2)
the cyclist
on 12 Sep 2020
Edited: the cyclist
on 12 Sep 2020
loc = {'Las Vegas, NV','North Las Vegas, NV'};
match = strcmp(loc,'Las Vegas, NV')
4 Comments
Walter Roberson
on 12 Sep 2020
I'm searching a cell array for an exact string
Use ismember()
7 Comments
Walter Roberson
on 12 Sep 2020
X = ismember((num),a));
1 1 0
2 -1
Count your open brackets.
See Also
Categories
Find more on Cell Arrays in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!