Hauptinhalt
Wörterbücher
Zuweisung von Daten zu Schlüsseln zur Indizierung der Werte
Ein Wörterbuch ist eine Datenstruktur, die jedem Schlüssel einen entsprechenden Wert zuweist. Schlüssel und Werte können beliebige Datentypen darstellen, wobei ein flexiblerer Datenzugriff als bei der Array-Indizierung und eine verbesserte Performance bereitgestellt wird.
dictionary
wird gegenüber containers.Map
empfohlen, da hier mehr Datentypen als Schlüssel und Werte unterstützt und bessere Leistungen gewährleistet werden. (seit R2022b)
Funktionen
dictionary | Object that maps unique keys to values (Seit R2022b) |
configureDictionary | Create dictionary with specified key and value types (Seit R2023b) |
insert | Add entries to a dictionary (Seit R2023b) |
lookup | Find value in dictionary by key (Seit R2023b) |
remove | Remove dictionary entries (Seit R2023b) |
entries | Key-value pairs of dictionary (Seit R2022b) |
keys | Keys of dictionary (Seit R2022b) |
values | Values of dictionary (Seit R2022b) |
types | Types of dictionary keys and values (Seit R2022b) |
numEntries | Number of key-value pairs in dictionary (Seit R2022b) |
isConfigured | Determine if dictionary has types assigned to keys and values (Seit R2022b) |
isKey | Determine if dictionary contains key (Seit R2022b) |
keyHash | Generate hash code for dictionary key (Seit R2022b) |
keyMatch | Determine if two dictionary keys are the same (Seit R2022b) |
Klassen
Themen
- Map Data with Dictionaries
Use dictionaries to store key-value pairs of different data types. (Seit R2022b)
- Dictionaries and Custom Classes
Modify custom classes for expected behavior in dictionaries.