Search a Structure Array or Database

Searches an entire database structure for the given values or strings, and returns corresponding indices of matching entries

現在この提出コンテンツをフォロー中です。

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://jp.mathworks.com/matlabcentral/fileexchange/112915-search-a-structure-array-or-database), MATLAB Central File Exchange. に取得済み.

Add the first tag.

一般的な情報

MATLAB リリースの互換性

  • すべてのリリースと互換性あり

プラットフォームの互換性

  • Windows
  • macOS
  • Linux
バージョン 公開済み リリース ノート Action
1.0.0