Main Content

本页采用了机器翻译。点击此处可查看英文原文。

plus, +

连接 Requirements Table模块中的字符串

自 R2022b 起

描述

示例

newStr = plus(str1,str2) 连接字符串 str1str2。在 Requirements Table模块中使用此运算符。

示例

newStr = str1 + str2 是执行 newStr = plus(str1,str2) 的另一种方法。

示例

全部展开

Requirements Table模块中,创建一个将字符串 "Hello," 与字符串 " world!" 连接起来的需求。输出为 "Hello, world!"

y = plus("Hello,"," world!")

This example shows a requirement that appends the string "Hello," to the string " world!" with the plus operator. The output is "Hello, world!".

或者,您可以使用 + 来连接两个字符串。

y = "Hello," + " world!"

This example shows a requirement that appends the string "Hello," to the string " world!" with +. The output is "Hello, world!".

输入参数

全部展开

输入字符串,指定为字符串标量。将文字字符串用双引号引起来。

示例: "Hello"

数据类型: string

输出参量

全部展开

输出字符串,以字符串标量形式返回。

限制

  • 该运算符不支持使用Simulink.Bus对象字段。

版本历史记录

在 R2022b 中推出