How to search for an exact string not just contains
235 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
the cyclist
am 12 Sep. 2020
Bearbeitet: the cyclist
am 12 Sep. 2020
loc = {'Las Vegas, NV','North Las Vegas, NV'};
match = strcmp(loc,'Las Vegas, NV')
4 Kommentare
Walter Roberson
am 12 Sep. 2020
I'm searching a cell array for an exact string
Use ismember()
7 Kommentare
Walter Roberson
am 12 Sep. 2020
X = ismember((num),a));
1 1 0
2 -1
Count your open brackets.
Siehe auch
Kategorien
Mehr zu Cell Arrays finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!