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

2 次查看(过去 30 天)
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.

采纳的回答

Craig
Craig 2014-6-2

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Modeling 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by