MATLAB: How to send a value from GUI to constant block in Simulink Model

matlab gui

I have threee constant block. And I want to value to those from GUI when ı pushed the button after ı take value from edit text blocks.

Best Answer

As far as I know, edit text blocks takes input arguments as string. What you need to do is to use set_param command and convert the variables to double by using str2double command.
We have had a previous discussion about it, so please refer to that discussion. Here is an example:
set_param('gui/Constant','Value','i')
set_param('gui/Constant1','Value','j')
Do not forget to convert these values to double.