Hi,
I understand that you are trying to set the value of 'Gain' parameter of a block in your simulink model ,from app designer, using the 'set_param' function.
Using the 'set_param' Function, if you assign the variable name to the 'value' string , the same string will appear in the corresponding Gain block in the simulink Model. Hence, if there is no variable in the base/model workspace with the same name, it will result in error.
One possible solution to avoid this would be to add a variable with the same name and value to the base workspace using the 'assignin' function.
For example, in this case, inside the same function in app designer, you can add the following lines of code .
assignin('base','K1',K1);
assignin('base','K2',K2);
assignin('base','K3',K3);
assignin('base','K4',K4);
Hope this helps!