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 个评论

Do you want to create a temporary variable ? Or a mask parameters ?
no i'm trying to creat a mask parameter.

请先登录,再进行评论。

 采纳的回答

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

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Author Block Masks 的更多信息

产品

版本

R2016b

标签

Community Treasure Hunt

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

Start Hunting!

Translated by