帮助中心帮助中心
本页翻译不是最新的。点击此处可查看最新英文版本。
字典的值
自 R2022b 起
v = values(d)
v = values(d,"cell")
v = values(d) 返回一个包含指定字典的值的数组。
v
d
示例
v = values(d,"cell") 可以选择以元胞数组形式返回值。
全部折叠
创建一个包含三个键-值对组的字典,这些对组将数字映射到字符串。
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"
使用 values 返回一个包含字典中存储的值的数组。
values
v = 3x1 string "Unicycle" "Bicycle" "Tricycle"
names = ["Unicycle" "Bicycle" "Tricyle"]; wheels = [1 2 3]; d = dictionary(wheels,names)
d = dictionary (double --> string) with 3 entries: 1 --> "Unicycle" 2 --> "Bicycle" 3 --> "Tricyle"
使用 values 返回一个数组,该数组包含作为元胞数组存储在字典中的值。
v=3×1 cell array {["Unicycle"]} {["Bicycle" ]} {["Tricyle" ]}
dictionary
字典,指定为 dictionary 对象。如果 d 未配置,values 将引发错误。
在 R2022b 中推出
dictionary | configureDictionary | insert | lookup | remove | entries | keys | types | numEntries | isConfigured | isKey
configureDictionary
insert
lookup
remove
entries
keys
types
numEntries
isConfigured
isKey
您点击的链接对应于以下 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