How to use a script to select drop-down menu options of component in Simulink?
조회 수: 11 (최근 30일)
이전 댓글 표시
Hello! I am using a simulator developed by another person in Simulink, and I want to test my simulation under different input parameters. The script I made is able to modify the values of the input boxes, but not to select options such as component names from drop-down menus. Is there any way to add this feature to my script?
When trying to make this in the same way as I did with numerical values for the boxes, using the set_param function, I got the following error:
??? Error using ==> set_param
Component block (mask) does not have a parameter named 'ComponentName'
Thank you!!
댓글 수: 0
답변 (2개)
Fangjun Jiang
2024년 1월 20일
It is unlikely. This is dependent on that "simulator developed by another person in Simulink". Either it provides an API for you to do that, or you have the source code to figure out an entry point.
댓글 수: 0
Andy Bartlett
2024년 1월 30일
If the entity you want to do set_param on is a block, then you can get a lot of information from DialogParameters.
The following code shows an example of programatically getting all the valid choices for a Product Blocks "Integer rounding mode" parameter.
mdl = 'foo';
new_system(mdl)
myBlk = [mdl,'/myProduct'];
add_block('built-in/Product',myBlk)
dp = get_param(myBlk,'DialogParameters')
dp.RndMeth
validChoicesForIntegerRoundingMode = dp.RndMeth.Enum
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!