Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Set the value in Simulink from GUI

Subject: Set the value in Simulink from GUI

From: Kwok

Date: 14 Jan, 2010 06:21:05

Message: 1 of 3

Hi,
I'm a beginner in using the GUI and also simulink. I have a problem about the program in GUI. I'd like to set the value in simulink from the GUI where the value can be set through the slider in GUI.
I have use the "set_param" to set the parameter of gain in simulink. However, it shows the error that" Subsystem block does not have a parameter named 'Gain' although the name that I used is Gain.
I have refer to the example in the Matlab help which used to set the gain of the control system

I'd appreciate the help on this
Thanks
Yoong

Subject: Set the value in Simulink from GUI

From: Phil Goddard

Date: 14 Jan, 2010 23:19:04

Message: 2 of 3

set_param requires you to specify 3 things:

1. The full path to the block:
i.e. if you have a model called MyModel, which contains a subsystem called mySubsystem, which contains a block called MyBlock, then the first input to set_param needs to be 'MyModel/MySubsystem/MyBlock'.

2. The particular property of that block that you want to change:
i.e. A gain block has a property called 'Gain'.
Search the doc for "Block-Specific Parameters" for a list of the properties for each block.

3. The new value for the property, typically set as a string:
i.e. a new gain value of '10'.

So you'd use the command
>> set_param('MyModel/MySubsystem/MyBlock','Gain','10');

From the error message you give it appears that you are trying to set the property of a subystem called 'Gain', but subsystems don't have a property called 'Gain' and hence the error.

Phil.

Subject: Set the value in Simulink from GUI

From: Kristijan

Date: 13 Mar, 2013 15:11:07

Message: 3 of 3

Hi,

I’ve a Simulink model named ‘example.mdl’ with parallel RLC branch. Branch Type is R, variable of resistance is ‘res’. How can I set value of resistance in GUIDE with set_param?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us