How to obtain allowed values for a configuration parameter programmatically?

Hi.
I am trying to analyse/study the impact of changes in configuration parameter settings programmatically, for our Simulink model and auto generated code. I know how to set the configuration parameters programmatically, for example
set_param(configObject,'DefaultParameterBehavior','Inlined');
I also know how to obtain all configuration parameters programmatically:
get_param(configObject, 'ObjectParameters')
Now, for the study it would greatly help if I could obtain the allowed values for each parameter, for example DefaultParameterBehavior can be Inlined or Tunable, according to the help documentation (https://nl.mathworks.com/help/rtw/ref/defaultparameterbehavior.html). Is there any way of obtaining these allowed values programmatically? Such that the result will be something like
{'Inlined','Tunable'}
Thanks in advance!

 채택된 답변

Selena Mastrodonato
Selena Mastrodonato 2024년 2월 2일
You can access these informations with get_param(object,'DialogParameters'). It gives you a struct with all parameters and every parameter has a field Enum with accepted values.

댓글 수: 3

I see that this works on Simulink blocks
>> object = gcb
object =
'control_model/Subsystem'
>> get_param(object,'DialogParameters')
ans =
struct with fields:
ShowPortLabels: [1×1 struct]
BlockChoice: [1×1 struct]
TemplateBlock: [1×1 struct]
Unfortuantely this does not seem to work on configuration sets:
object =
Simulink.ConfigSet
>> get_param(object,'DialogParameters')
Property 'DialogParameters' does not exist
I don't know if this can be useful, but if you use this command get_param(0,'ObjectParameters'), you'll obtain global and model parameters, included configuration parameters.
Yes this works! Thank you very much :-)
>> opbjectParam = get_param(0,'ObjectParameters');
>> opbjectParam.DefaultParameterBehavior
ans =
struct with fields:
Type: 'ConfigSet_Opt_DefaultParameterBehavior_EnumType'
Enum: {2×1 cell}
Attributes: {'read-and-controlled-write' 'read-only-if-compiled'}
>> opbjectParam.DefaultParameterBehavior.Enum
ans =
2×1 cell array
{'Tunable'}
{'Inlined'}

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Osama
Osama 2024년 2월 28일
how i can configuration the compounant

카테고리

도움말 센터File Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2024년 2월 2일

답변:

2024년 2월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by