string
描述
将输入的 str
= string(X
)X
转换为字符串。在 Requirements Table模块中使用此运算符。
示例
将布尔值转换为字符串
将布尔值转换为字符串 "true"
。
str = string(true);
将输入转换为字符串
在 Requirements Table模块中,创建将数字 3145
转换为字符串的需求。
y = string(3145)
输入参数
X
— 输入值
标量
输入值,指定为标量。
如果 X
是数字数据类型,则它必须是整数。例如,A
可以等于 25
,但不能等于 2.5
。
数据类型: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
| string
复数支持: 是
输出参量
str
— 输出字符串
字符串标量
输出字符串,以字符串标量形式返回。
版本历史记录
在 R2022b 中推出
另请参阅
MATLAB 命令
您点击的链接对应于以下 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:
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
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)