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

2 vues (au cours des 30 derniers jours)
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.

Réponse acceptée

Craig
Craig le 2 Juin 2014

Plus de réponses (0)

Catégories

En savoir plus sur Modeling dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by