custom type in Simulink S-Function internal state

5 ビュー (過去 30 日間)
Florent
Florent 2013 年 11 月 25 日
コメント済み: Simon 2014 年 5 月 22 日
Hi all,
What's the correct way to keep an internal reference to an object inside a Simulink Matlab level 2 S-Function. Buitins block.Dwork and block.ContState only support data types, I need to keep a reference to a network object tcp/udp and the following code fails:
block.Dwork(1).Data = tcpip('localhost',1234);
with message:
Invalid assignment in 'test/test'. Data must be a numeric or logical array
Looking at the documentation, I see no way to keep this reference in a "clean" way. The page http://www.mathworks.fr/fr/help/simulink/sfg/custom-data-types.html is about defining types for inputs/outputs and I understand limitations for signals entering and leaving the block. My case is a little bit different: this internal object should be kept during simulation but it is not intended to leak from the Simulink block.
Any help?
TIA
- Florent

採用された回答

Florent
Florent 2013 年 11 月 25 日
Half-self-answer: I managed to get this block run by the creation of a global list of objects. The simulink blocks just keep a reference (index as a scalar value) to these objects in their own state space.
  1 件のコメント
Simon
Simon 2014 年 5 月 22 日
Can you post a code snippet? I'm trying to solve a similar problem.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBlock Creation Basics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by