MATLAB Answers


Mask editor problem.

Asked by Badr Taleb on 3 Jun 2018
Latest activity Commented on by Badr Taleb on 4 Jun 2018
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?


on 4 Jun 2018
Do you want to create a temporary variable ? Or a mask parameters ?
Badr Taleb on 4 Jun 2018
no i'm trying to creat a mask parameter.

Sign in to comment.




1 Answer

Answer by TAB
on 4 Jun 2018
 Accepted Answer

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 Comment

Badr Taleb on 4 Jun 2018
thank you for your help. it's working

Sign in to comment.