More than one output for level-2 S-function
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
Kaustubha Govind
le 20 Nov 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 commentaires
Kaustubha Govind
le 27 Déc 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
le 5 Nov 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
Voir également
Catégories
En savoir plus sur Configure Block Features for MATLAB S-Functions 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!