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!