Communications Blockset | ![]() ![]() |
Write to a file at each rising edge of an input signal
Library
Description
The Triggered Write to File block creates a file containing selected data from the input signal. Unlike Simulink's To File block, the Triggered Write to File block writes new data to the file only at the rising edge of the input trigger signal. However, the To File block is useful for creating platform-independent MAT-files.
The file can be an ASCII text file, a file containing integer or floating-point numbers, or a binary file (in the format of the C fwrite
function). You specify the file type using the Data type parameter. If Data type is ASCII then this block converts the data into ASCII characters before writing, using the mapping shown on the reference page for the Triggered Read From File block. For example, an input of 65 would cause the block to write the character "A" to the file. Other file types receive the data directly.
The first input signal contains the data to write. This input must be sample-based. The second input signal is a sample-based scalar trigger signal that controls the timing of writing. When a rising edge of the input trigger signal is detected, this block writes the elements of the data signal to the file. The file does not contain information about the dimension or orientation of the data input, however.
The first write always occurs at the first rising edge. After that, the Decimation parameter determines how many triggers the block receives between successive file writes. Setting this parameter to 1 causes the block to write at every rising edge.
Dialog Box
Pair Block
See Also
To File (Simulink)
![]() | Triggered Read From File | Uniform Noise Generator | ![]() |