More than one output for level-2 S-function

15 visualizaciones (últimos 30 días)
upt0zer0
upt0zer0 el 20 de Nov. de 2012
Comentada: Michael Stich el 5 de Nov. de 2015
Hi
i have the following problem. My Level-2 s-function needs a second output.
thats what i've done:
if true
% Register number of ports
block.NumInputPorts = 2;
block.NumOutputPorts = 1;
% Setup port properties to be inherited or dynamic
block.SetPreCompInpPortInfoToDynamic;
block.SetPreCompOutPortInfoToDynamic;
% Override input port properties
block.InputPort(1).Dimensions = [10,1];
block.InputPort(1).DatatypeID = 0; % double
block.InputPort(1).Complexity = 'Complex';
% Override output port properties
block.OutputPort(1).Dimensions = [10,1];
block.OutputPort(1).DatatypeID = 0; % double
block.OutputPort(1).Complexity = 'Complex';
block.OutputPort(2).Dimensions = [5,1];
block.OutputPort(2).DatatypeID = 0; % double
block.OutputPort(2).Complexity = 'Complex';
end
when i start the simulation, always this pops out: "Level-2 MATLAB S-function 'Sync_fehlerkorrektur' in 'Gesamtmodell/Synchronisation' does not have a 'SetInputPortSamplingMode' method. When a Level-2 MATLAB S-function with multiple output ports has dynamic sampling mode setting for any of its ports, it is necessary to register a 'SetInputPortSamplingMode' method"
I searched for this "SetInputPortSamlingMode"-method, but i didn't find anything which helps me.
Can anybody help me? Short explanation and an example plz!
Thx

Respuestas (1)

Kaustubha Govind
Kaustubha Govind el 20 de Nov. de 2012
If need to have two output ports, shouldn't you have:
block.NumOutputPorts = 2; %you've set this to 1
Also, right after you set the output port complexities, also set their sampling mode as the error suggests:
block.OutputPort(1).SamplingMode = 'Sample';
block.OutputPort(2).SamplingMode = 'Sample';
You need to define a SetInputPortSamplingMode method only if you need the output SamplingMode to be inherited.
  3 comentarios
Kaustubha Govind
Kaustubha Govind el 27 de Dic. de 2012
Stev: If you'd like the output sampling mode to be inherited, you need to implement a SetInputPortSamplingMode method to specify where it's inherited from (you have 5 inputs). Please look at msfuntmpl.m for an example (can be located by typing "which msfuntmpl").
Michael Stich
Michael Stich el 5 de Nov. de 2015
Thank you, this helped figure it out. Little sparse on the details however.
And, why is this SetInputPortSamplingMode method not anywhere to be found in the doc? If it is there I can't find it and I've tried multiple ways of looking. R2015b

Iniciar sesión para comentar.

Categorías

Más información sobre Block and Blockset Authoring en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by