MATLAB: How does the outport block export capability behave in a multi-rate system

behavioroutportsimulink

I have a multi-rate model which has a pulse generator block connected to an outport and a To Workspace block. There is another pulse generator block that is only connected to an outport block. When I run the simulation the sizes of both outputs are the same, even though the sample times are different. This can be observed when different sample colors are displayed for both pulse generator blocks.

Best Answer

The behavior of the outport block for a multi-rate system can be explained as follows:
In a slower rate, the outport block will be repeating its values until the next update. In a sense, the sample time colors are correct because the outport is only being updated and changing its values according to its sample time, and holding the last value until the next update. Similarly, in the case with frame-based signals, the outputs are repeated until the next update.
The configuration of data export through outport blocks are done through the configuration parameters. Configuration parameters always control the settings for the entire model as opposed to individual blocks. The configuration parameter control the export of tout, which is your time base.
The main reason the outport is repeating the data is that there is only one location where the time vector tout is controlled, and the only way to cover all the data is to use the time base of the model, which is the fastest sample rate.
This is different from the 'To Workspace’ block where we can control the save format per block allowing you to control the time output individually.