Start of trail String Concatenate navigation bar

Table of Contents

String Accumulate

Accumulates a series of strings into one concatenated string.

Library

QUARC Targets/Strings

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

qc_open_library('quarc_library/Strings')

Description

String Accumulate

The String Accumulate block may be used to concatenate a series of strings together. Each time the block executes it appends the input string to its output, as long as the acc (accumulate) input is non-zero. If the acc is false then it simply copies its input to its output. The String Accumulate block is typically used inside For Iterator Subsystem or While Iterator Subsystem blocks to concatenate strings produced within the iterated subsystem.

Hint A common way to use the String Accumulate block in a For Iterator Subsystem is to feed the output of the For Iterator block to a Compare To Constant block set to "> 1". The output of the Compare To Constant block is then directed to the acc input of the String Accumulate block. This configuration causes the output string to be initialized to the input string on the first iteration of the loop, and then the input string to be concatenated to the output on subsequent iterations.

The input string must be a null-terminated vector of UTF-8 (or uint8) characters, which are used to represent strings in QUARC, or a Simulink "string". The output has the same data type. The maximum length of the output string is determined by the Maximum length parameter. The output string is always null-terminated.

The String Accumulate block supports variable-size input and output strings. To generate a variable-size output string, select the variable-size signal option for the Output dimensions mode parameter or allow the dimensions mode to be inherited from the input string. Variable-size input strings are supported regardless of the state of the Output dimensions mode parameter. See Variable-Size Signals for more information on variable-size signals.

Input Ports

str

A string represented as a null-terminated vector of UTF-8 characters or uint8 values. It may be a variable-size signal. It also accepts the Simulink "string" data type.

acc

The input string is copied to the output when this input is zero. When it is non-zero then the input string is appended to the output.

Output Ports

str

The accumulated string. The string is represented as a null-terminated vector of UTF-8 characters or uint8 values. It will be a fixed-size or variable-size signal depending on the Output dimensions mode and input string.

Data Type Support

This block outputs the string as a null-terminated vector of UTF-8 characters or uint8 values. The input string must be the same type or a Simulink "string". Variable-size signals are supported for both the input and output strings. See Variable-Size Signals for more information on variable-size signals.

The acc signal may be any of the standard Simulink numeric types. Fixed-point data types are not currently supported.

Parameters and Dialog Box

String Accumulate

Maximum string length

The maximum length of the output string in code units (bytes), including the null-terminator. The output will be a vector of this length.

Output dimensions mode

This parameter determines whether the str output is a fixed-size signal or a variable-size signal. The maximum size of this output is equal to the value of the Maximum string length parameter. However its length will vary dynamically with the size of the accumulated string when the output is variable-size. The default is to inherit the dimensions mode from the input string so that a variable-size signal at the input will produce a variable-size signal at the output and otherwise the output is fixed-size. Refer to Variable-Size Signals for more information on variable-size signals.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar