Compose String
Compose output string signal based on specified format and input signals
- Library:
Simulink / String
Description
TheCompose Stringblock composes output string signal based on the format specifier listed in theFormatparameter. TheFormatparameter determines the number of input signals. If there are multiple inputs, the block constructs the string by combining these multiple inputs in order, and applying the associated format specifier, one format specifier for each input. Each format specifier starts with a percent sign,%
, followed by the conversion character. For example,%f
formats the input as a floating point output. To supplement the string output, you can also add a character to the format specification. Use this block to compose and format an output string signal from a multiple inputs.
For example, if theFormatparameter contains"%s is %f"
, the block expects two inputs, a string signal and a single or double signal. If the first input is the string"Pi"
and the second input is a double value3.14
, the output is"Pi is 3.14"
.
When a MinGW®compiler compiles code generated from the block, running the compiled code may produce nonstandard results for floating-point inputs. For example, a numeric input of501.987
returns the string"5.019870e+002"
instead of the expected string"5.019870e+02"
.
Ports
Input
Output
Parameters
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Algorithms
Extended Capabilities
See Also
ASCII to String|Scan String|sprintf
|String Compare|String Concatenate|String Constant|String Find|String Length|String to ASCII|String to Double|String to Enum|String to Single|Substring|To String