MATLAB 帮助中心
本页翻译不是最新的。点击此处可查看最新英文版本。
删除字典条目
自 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"
删除与 [2,3] 对应的条目。
[2,3]
d = remove(d,[2,3])
d = dictionary (double ⟼ string) with 1 entry: 1 ⟼ "Unicycle"
dictionary
输入字典,指定为 dictionary 对象。
键集,指定为数组。key 的数据类型必须匹配或可转换为 d1 中键的数据类型。
全部展开
您可以为字典 remove 函数生成 C/C++ 代码。
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处