A flexible tool capable of searching a large structure array for matching numerical or character values.
Use case:
[ index_array ] = searchDatabase( dataBase, value, fieldName, modifier)
Required Inputs:
dataBase (struct array or matrix) : struct database to search
value (char or double(value or list) ) : Value/string of fieldname desired to search for or match to
String input is case-insensitive. By default, searches for partial matches to strings.
Optional Inputs:
fieldName (string) : Fieldname of database to searach within (case-insensitive). Default value is an empty string.
If a value is given, will only search for matches in struct fields matching the given fieldName.
modifier (char) : Has 5 allowable values; '=', '~', '>', '<', and '' (empty string). The function varies based on class of value:
If value is a char or string:
1. '': case-insensitive search for value as substring of database field value (default for strings)
2. '=': case-insensitive search for value as exact, full-string match to database field value
3. '~': case-insensitive search for absence of value as substring of database field value
If value is a double:
1. '=': value must be equal to database field value (default value for double)
2. '<': value must be greater than database field value
3. '>': value must be less than database field value
4. '~': value must not be equal to database field value
Output is a list of indices corresponding to the entries in the database matching the criteria supplied by the inputs.
If dataBase is a 2D array (or higher dimensionality), this tool will still return the correct result, however to convert to the full index array you will need to use matlab's ind2sub function.
인용 양식
Derek Wood (2026). Search a Structure Array or Database (https://kr.mathworks.com/matlabcentral/fileexchange/112915-search-a-structure-array-or-database), MATLAB Central File Exchange. 검색 날짜: .
MATLAB 릴리스 호환 정보
개발 환경:
R2022a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux태그
| 버전 | 게시됨 | 릴리스 정보 | |
|---|---|---|---|
| 1.0.0 |
