Main Content

plus, +

Concatenate strings in Requirements Table block

Since R2022b

Description

example

newStr = plus(str1,str2) concatenates the strings str1 and str2. Use this operator in the Requirements Table block.

example

newStr = str1 + str2 is an alternative way to execute newStr = plus(str1,str2).

Examples

expand all

In a Requirements Table block, create a requirement that concatenates the string "Hello," with the string " world!". The output is "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!".

Alternatively, you can use + to concatenate two strings.

y = "Hello," + " world!"

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

Input Arguments

expand all

Input strings, specified as string scalars. Enclose literal string with double quotes.

Example: "Hello"

Data Types: string

Output Arguments

expand all

Output string, returned as a string scalar.

Limitations

  • This operator does not support the use of Simulink.Bus object fields.

Version History

Introduced in R2022b