How to copy input port dimensions to output port dimensions in a Level 2 s-function on initialisation?

2 views (last 30 days)
I have some inputs that inherit sizes
block.InputPort(1).Dimensions = -1;
block.InputPort(1).SamplingMode='Sample';
block.InputPort(2).Dimensions = -1;
block.InputPort(2).SamplingMode='Sample';
block.InputPort(3).Dimensions = 1;
block.InputPort(3).SamplingMode='Sample';
I then have some outputs
block.OutputPort(1).Dimensions = block.InputPort(2).Dimensions
block.OutputPort(1).SamplingMode='Sample';
block.OutputPort(2).Dimensions = block.InputPort(2).Dimensions
block.OutputPort(2).SamplingMode='Sample';
block.OutputPort(3).Dimensions = block.InputPort(2).Dimensions
block.OutputPort(3).SamplingMode='Sample';
block.OutputPort(4).Dimensions = 1;
block.OutputPort(4).SamplingMode='Sample';
The above code doesn't do what I intend i.e. to make output ports 1,2 and 3 the same dimensions as input port 2.

Accepted Answer

Craig
Craig on 2 Jun 2014

More Answers (0)

Categories

Find more on Modeling in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!