Pleas how can i creat a variable in mask that can be calculated from other two variables from the same mask like x=a+b, i tried to use the instruction ' * set_param('model/block','variable','a+b');*' in the Initialization, but no result appear in the mask, pleas how can i make this variable automaticly updated working?

2 件のコメント

TAB
TAB 2018 年 6 月 4 日
Do you want to create a temporary variable ? Or a mask parameters ?
Badr Taleb
Badr Taleb 2018 年 6 月 4 日
no i'm trying to creat a mask parameter.

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

 採用された回答

TAB
TAB 2018 年 6 月 4 日

1 投票

In Mask Initialization function
aVal = str2double(get_param(gcbh, 'a')); % a is existing mask parameter
bVal = str2double(get_param(gcbh, 'b')); % b is existing mask parameter
set_param(gcbh, 'c', num2str(aVal+bVal)); %c is existing mask parameter

1 件のコメント

Badr Taleb
Badr Taleb 2018 年 6 月 4 日
thank you for your help. it's working

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeAuthor Block Masks についてさらに検索

製品

リリース

R2016b

タグ

質問済み:

2018 年 6 月 3 日

コメント済み:

2018 年 6 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by