CStrAinBP

버전 1.1.0.0 (37.3 KB) 작성자: Jan
Overlapping elements of 2 cell strings. 10-20 times faster than INTERSECT/ISMEMBER/SETDIFF.
다운로드 수: 1.6K
업데이트 날짜: 2009/9/12

라이선스 보기

Find overlap of 2 cell strings.
This can be used for a faster calculation of:
INTERSECT, ISMEMBER, SETDIFF and UNION.

Comparison to Matlab's INTERSECT:
- Consider repeated strings (no internal UNIQUE)
- No sorting
- Can be insensitive for upper/lower case
- M-version as demonstration of the method
- MEX-version: 90% to 98% faster than INTERSECT

[AI, BI] = CStrAinBP(A, B, CaseSensitive)
INPUT:
A, B: Cell strings.
CaseSensitive: Optional string to trigger sensitivity for case.
OUTPUT:
AI: Indices of common strings in A.
Each occurence of repeated strings is considered.
AI is sorted from low to high indices.
BI: Indices of common strings in B.
If B is not unique, the first occurrence of a string is used.
such that A{AI} == B{BI}.

EXAMPLES:
[AI, BI] = CStrAinBP({'a', 'b', 'q', 'a'}, {'a', 'c', 'd', 'a', 'b'})
replies: AI = [1, 2, 4] and: BI = [1, 5, 1]

[AI, BI] = CStrAinBP({'a', 'b', 'A'}, {'a', 'c', 'a', 'B', 'b'}, 'i')
replies: AI = [1, 2, 3] and: BI = [1, 4, 1]

INCLUDED FILES:
CStrAinBP.m: Proof of concept, demonstration.
CStrAinBP.C: Fast MEX function.
CStrAinBP.MEXW32: Compiled for Matlab 7 with LCC3.8.
Please recompile it with your favorite compiler.
Matlab6/CStrAinBP.DLL: Compiled for Matlab 6 with BCC5.5.
For Matlab 6, replace the MEXW32 file by this DLL.
TestCStrAinBP: Run the test after installation or compiling.

Tested: Matlab 6.5, 7.7, 7.8, Win2K/XP

인용 양식

Jan (2024). CStrAinBP (https://www.mathworks.com/matlabcentral/fileexchange/24380-cstrainbp), MATLAB Central File Exchange. 검색됨 .

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

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.1.0.0

- Sensitivity for case triggered by 3rd input.
- Don't crash for uninitialized cell elements.
- Cleaned doc.

1.0.0.0