Simulink的S​etInputPor​tSamplingM​ode。

报错求助:
Level-2 M-file S-function does not have a 'SetInputPortSamplingMode' method. When a Level-2 M-file S-function with multiple output ports has dynamic sampling mode setting for any of its ports, it is necessary to register a 'SetInputPortSamplingMode' method.
但是,我看Template文件里也没有这个所谓的“SetInputPortSamplingMode”,不知道怎么办

 Réponse acceptée

hirokit
hirokit le 26 Nov 2022

1 vote

block.RegBlockMethod('SetInputPortSamplingMode',@SetInputPortSamplingMode);
block.RegBlockMethod('SetInputPortDimensions', @SetInpPortDims);
block.RegBlockMethod('Outputs', @Output);
function SetInputPortSamplingMode(block, idx, fd)
block.InputPort(idx).SamplingMode = fd;
block.InputPort(idx).SamplingMode = fd;
block.OutputPort(1).SamplingMode = fd;
block.OutputPort(2).SamplingMode = fd;
function SetInpPortDims(block, idx, di)
block.InputPort(idx).Dimensions = di;
function Output(block)
block.OutputPort(1).Data = block.InputPort(1).Data;
block.OutputPort(2).Data = block.InputPort(2).Data;
是个callback function

Plus de réponses (0)

Catégories

En savoir plus sur Simulink 函数 dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!