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”,不知道怎么办

 採用された回答

hirokit
hirokit 2022 年 11 月 26 日

1 投票

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeUser-Defined Functions についてさらに検索

タグ

質問済み:

2022 年 11 月 26 日

回答済み:

2022 年 11 月 26 日

Community Treasure Hunt

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

Start Hunting!