dynamic Mask for a subsystem based on user input

2 ビュー (過去 30 日間)
Vimal Kumar
Vimal Kumar 2018 年 11 月 3 日
回答済み: Arunkumar M 2018 年 11 月 10 日
Hello all, I am a beginner, I am trying to understand masking for a subsystem, what I was trying to do is based on the number of in ports user specify I wanted to create the same number of in ports in the subsystem, I created a edit box with a parameter n and in initialization I created a dialog variable n, with the following code, while n add_block('built-in/Inport',[gcb,n]); n=n-1; end % switch
My scope is to assign the port name with value of 'n'.
the problem I am facing is the ports are created outside the subsystem and the name of the port is not as I expected and every time it runs it creates an additional port.

回答 (1 件)

Arunkumar M
Arunkumar M 2018 年 11 月 10 日
You may need to specify path of subsystem instead of gcb. The name of the block should be a string. Is "n" a number? Use: [gcb,,'/',num2str(n)]

カテゴリ

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

タグ

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by