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 Exchange에서 Simulink 函数에 대해 자세히 알아보기

태그

질문:

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!