帮助中心帮助中心
本页翻译不是最新的。点击此处可查看最新英文版本。
将值转换为字符串
自 R2021b 起
str = string(X)
示例
str = string(X) 将输入 X 转换为字符串。
str
X
注意
使用 C 语言作为动作语言的 Stateflow® 图不支持 string 运算符。要获得类似的功能,请使用 tostring。
string
tostring
全部展开
将整数标量转换为字符串 "1307"。
"1307"
str = string(1307);
将布尔值转换为字符串 "true"。
"true"
str = string(true);
输入值,指定为整数标量、布尔标量或字符数组。要创建由空白字符组成的字符数组,请使用 blanks 运算符。
blanks
示例: str = string(1307)
str = string(1307)
示例: str = string(true)
str = string(true)
示例: str = string(blanks(n))
str = string(blanks(n))
在 R2021b 中推出
str2double | blanks | tostring
str2double
您点击的链接对应于以下 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