How to add Inputs/Outputs to Stateflow by code

I want to add an input to a Stateflow chart by code.
The way to do it without code is to go to tools/model explorer, click the add data button and choose the scope to be an input.
How do I do it by code?
The way I am currently doing is adding an IN port from matlab with the add_block function, but when I do it this way the port does not show in the model explorer. Is this a bug or is there another way to do it by code that adds the variable to the model explorer?

 採用された回答

Camba
Camba 2016 年 6 月 2 日

0 投票

Problem solved. I did it by getting a handle to a state or chart. For example:
ch = sfgco; data = Stateflow.Data(ch); data.Scope = 'Input';

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDecision Logic についてさらに検索

製品

質問済み:

2016 年 5 月 31 日

回答済み:

2016 年 6 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by