strlookup

버전 1.2.0.0 (11.3 KB) 작성자: Chad Greene
Find strings in a list of cells and return near matches if no exact match is found.
다운로드 수: 516
업데이트 날짜: 2015/1/11

라이선스 보기

This function uses strcmp or strcmpi to return indices of a list of strings matching an input string. If no matches are found, close matches are suggested.

Syntax
ind = strlookup('string',list)
ind = strlookup(...,'CaseSensitive')
ind = strlookup(...,'threshold',ThresholdValue)
[ind,CloseNames] = strlookup(...)

Description
ind = strlookup('string',list) returns indices ind corresponding to cell entries in list matching 'string'.

ind = strlookup(...,'CaseSensitive') performs a case-sensitive strlookup.

ind = strlookup(...,'threshold',ThresholdValue) declares a threshold value for close matches. You will rarely (if ever) need to use this. The ThresholdValue is a metric of how closely matches should be when offering suggestions. Low threshold values limit suggested matches to a shorter list whereas high thresholds expand the list size. By default, the threshold starts at 1.5, then increases or decreases depending on how many close matches are returned. If fewer than 3 close matches are returned, the threshold is increased and it looks for more matches. If more than 10 close matches are found, the threshold is tightened (reduced) until fewer than 10 matches are found.

[ind,CloseNames] = strlookup(...) suppresses command window output if no exact match is found, and instead returns an empty matrix ind and a cell array of close matches in names. If exact match(es) is/are found, ind will be populated and CloseNames will be empty.

인용 양식

Chad Greene (2024). strlookup (https://www.mathworks.com/matlabcentral/fileexchange/47577-strlookup), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2012b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Cell Arrays에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

strlookup/html/

버전 게시됨 릴리스 정보
1.2.0.0

Close matches are now a blend of spectral and alphabetical matches. Changed the name of output variable from NearbyNames to CloseNames for clarity. Fixed the bug that Bryan pointed out.

1.1.0.0

Now returns NearbyNames and suppresses command window output when two output arguments are requested.

1.0.0.0