Is there a command to generate the parameter values for all user-defined parameters in a specific block instead of a different command for each parameter?

1 view (last 30 days)
MADISON OHARA
MADISON OHARA on 7 Sep 2021
Answered: Kumar Pallav on 27 Oct 2021
I know how to use the command: paramValue = get_param('Name of model/Name of block', 'Name of block parameter') to generate the value of a specific parameter for a block within a simulink model. Is there a command that generates the value of all user-defined parameters within a single block? For example, if I had a sine wave block in simulink and wanted to use matlab to generate the values of the amplitude, frequency, bias, phase, etc., I would have to write a line of code for each parameter. I want to be able to write one line of code and generate all of these values.

Answers (1)

Kumar Pallav
Kumar Pallav on 27 Oct 2021
Hi,
You can try the following command to get a list of block dialog parameters.
get_param('mymodel/myblock','DialogParameters')
You can get the values of any block parameter from the list by using the following command:
get_param('mymodel/myblock','ParameterName')
Please refer this document for more details on 'get_param'.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!