Simulink Level 2 S function, define port name

2 ビュー (過去 30 日間)
vivek patel
vivek patel 2021 年 1 月 17 日
I would like to assign port names to input and output ports of a Level 2 S function and then use them while the output or update function is called.
But when i try to do that in the setup method by below code then it gives error saying the port name is readonly. I tried creating mask in simulink and then check the portname in update function callback but it gives me back a empty character vector. How can i do that ?
function setup(block)
block.NumDialogPrms = 1;
%% Register number of input and output ports
block.NumInputPorts = 0;
block.NumOutputPorts = 1;
%% Setup functional port properties to dynamically
%% inherited.
block.SetPreCompInpPortInfoToDynamic;
block.SetPreCompOutPortInfoToDynamic;
block.OutputPort(1).Dimensions = 1;
block.OutputPort(1).SamplingMode = 'Sample';
block.OutputPort(1).Name = 'Test';

回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

タグ

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by