帮助中心帮助中心
本页翻译不是最新的。点击此处可查看最新英文版本。
删除字典条目
自 R2023b 起
d2 = remove(d1,key)
d2 = remove(d1,key) 从字典 d1 中删除对应于 key 的条目。
d2
d1
key
d = remove(d,key) 等效于 d(key) = [ ]。
d = remove(d,key)
d(key) = [ ]
示例
全部折叠
创建一个包含几个键-值对组的字典。
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"
删除对应于 2 的条目。
2
d = remove(d,2)
d = dictionary (double --> string) with 2 entries: 1 --> "Unicycle" 3 --> "Tricycle"
dictionary
输入字典,指定为 dictionary 对象。
键集,指定为数组。key 的数据类型必须匹配或可转换为 d1 中键的数据类型。
在 R2023b 中推出
dictionary | insert | lookup | entries | keys | values | isKey | types | configureDictionary | isConfigured | numEntries
insert
lookup
entries
keys
values
isKey
types
configureDictionary
isConfigured
numEntries
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
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:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office