MATLAB Help Center
Remove dictionary entries
Since R2023b
d2 = remove(d1,key)
d2 = remove(d1,key) removes the entry corresponding to key from dictionary, d1.
d2
d1
key
d = remove(d,key) is equivalent to d(key) = [ ].
d = remove(d,key)
d(key) = [ ]
example
collapse all
Create a dictionary containing several key-value pairs.
names = ["Unicycle" "Bicycle" "Tricycle"]; wheels = [1 2 3]; d = dictionary(wheels,names)
d = dictionary (double ⟼ string) with 3 entries: 1 ⟼ "Unicycle" 2 ⟼ "Bicycle" 3 ⟼ "Tricycle"
Remove the entry corresponding to 2.
2
d = remove(d,2)
d = dictionary (double ⟼ string) with 2 entries: 1 ⟼ "Unicycle" 3 ⟼ "Tricycle"
Remove the entries corresponding to [2,3].
[2,3]
d = remove(d,[2,3])
d = dictionary (double ⟼ string) with 1 entry: 1 ⟼ "Unicycle"
dictionary
Input dictionary, specified as a dictionary object.
Key set, specified as an array. The data type of key must match or be convertible to the data type of keys in d1.
expand all
You can generate C/C++ code for the dictionary remove function.
remove
dictionary | insert | lookup | entries | keys | values | isKey | types | configureDictionary | isConfigured | numEntries
insert
lookup
entries
keys
values
isKey
types
configureDictionary
isConfigured
numEntries
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
Europe
Asia Pacific
Contact your local office