Write formatted ASCII data to communication channel
Write formatted ASCII data to a port or file. After you have added a Stream Output block to your model, double-click the Stream Output block to open the Block Parameters: Stream Output dialog box.
The driver must be one of:
Standard Devices > Serial Port
Standard Devices > File
Standard Devices > UDP Protocol
When you install a UDP device, enter port addresses in decimal format in the Standard Devices UDP Protocol dialog box.
Any serial output port can send data with sample rates up to 500 Hz. To enable a faster sample rate of up to 10 kHz for some output serial ports, click Install new board, select Standard Devices > Serial Port, and select Direct port access.
The block does not support this option with all types of serial output hardware.
Input Data— Data to write to communication channel
Data values that are sent to the communication channel as ASCII data, encoded according to Format string.
Input port sizes— Specify number and width of ports
1(default) | vector
Enter a port width, or vector of port widths. The number of
elements determines the number of input ports. Each port has the width
specified by the corresponding element. For example, specifying
that the block has three input ports: a vector of width
a scalar, and a vector of width
2, for a total
of six elements. You specify only the widths.
Format string— Format of data items being written to the stream
'%g'(default) | character vector
Enter a specification in the same format used by C library I/O
printf. The format string describes
the data to be sent. The format string must have the same number of
specifiers as the sum of the elements of Input
For example, assume that Input port sizes is
Then a Format string of
'%d %d %d %f
%d %d' outputs ASCII representing:
Three integers from the vector on the first input port
One double from the scalar on the input second port
Two integers from the vector on the third input port
If the data type specified in the Format string for a value differs from the type of the actual value, type conversion occurs. Converted data that conforms to the Format string is output as ASCII to the device.
Initial string— Data to send when simulation begins
Optional. Enter a character vector. When simulation begins, send the specified data before the other data that is sent during simulation.
The character vector can contain anything. You can use it to initialize a device. It is sent literally as specified, without reference to Format string.
Final string— Data to send when simulation ends
Optional. Enter a character vector. When simulation ends, after the other data that is sent during simulation, send the specified data.
The character vector can contain anything. You can use it to shut down a device. It is sent literally as specified, without reference to Format string