MATLAB: How to display paremeter value in Simulink Mask

masksimulink

Hello there,
I am using Matlab 2019b. I have Simulink Model that is linked to a Data Dictionary. This Data Dictionary contains list of parameters that I am using within my Simulink model. My Simulink Model contains two subsystem.
Subsystem 1: I am using Subsystem 1 to change Parameter values and output from this subsystem is going to subsystem 2 as input.
Because I have many parameters to play with, it make sense to Mask it.
I managed to do everything I wanted execpt one thing for now that is following
I have a parameter called cranePlacement (In the picture below written as Crane Placement), now based on user entered value I want to change
WheelBase Paramter value automatically without user intraction and display the value as read only. I know there is a way to do it, where the wheelBase is a parameter and its value is needs to be set for example it could be something like this
%I want put this code or similar in Callback function of wheelBase1, where cranePlacement is Parameter avaiable in link data dictionary and same tab in the Mas
if(cranePlacement == 0 || cranePlacement ==1)
temp = 5000;
else
temp = 6000;
end
wheelBase=temp
set_param(gcb, 'wheelBase1', wheelBase)
But this doesnt work and I get error. I was wander if there is an example that I can follow or you can suggest me proper way to do it.
Eventually I will have 10 more parameters values shown as readonly.
Please let me know, if you need more information.
Best regards
Bilal

Best Answer

Ok I found my way around it, I am not sure if this is best solution, but it did work for me.
cp=str2num(get_param(gcb,'cranePlacement'))
if(cp==0 || cp==1)
set_param(gcb,'wheelBase1','5100')
else
set_param(gcb,'wheelBase1','5600')
end