Using Buses with MATLAB System Blocks
This example shows how to use buses as inputs and outputs to the MATLAB System block.
- The Gain block uses a System object™ that applies the gain specified in the block to the bus elements 'a' and 'b' of the incoming bus. The output of the block is the same bus type as the input.
- The Math Operations block uses a System object that computes the sum, product, and difference between the two bus elements 'a' and 'b' of the input bus. The output of the block is a bus with three elements: 'sum', 'prod', and 'diff'.
- Note, if a System block output bus is the same type as the input bus, you must still specify the output bus name in the 'getOutputDataTypeImpl' method. This is because the 'propgatedInputDataType' method does not return the input bus object during bus propagation.
- Before model initialization, all bus types used as either inputs or outputs to the MATLAB System block must be available in the MATLAB base workspace.