How to assign state labels of combo box dynamically?
8 次查看(过去 30 天)
显示 更早的评论
I have created a "class_usecase" class that define certain use cases I want to simulate. One of the class properties is "name". After that I create an array of use cases of the class "class_usecase". In Simulink I want to be able to select which use case I want to simulate using a drop down menu. This is done with the Combo Box block, where I use "state value" to define the element of the array, "state label" shows a coprehensible title of the use case, equal to "usecase(x).name". This works, however, I don't want to type and order the state values and labels manually. The array of use cases changes, it is double work to update the Combo Box and it is prone inconsisteny between the dropdown and the array of use cases. It is not possible to put variables as parameters in the Combo Box, and I can also not find the state values and state labels using get_param(). Does anyone have suggestions how I could automate this, so the dropdown syncs to the array in the workspace?
0 个评论
回答(1 个)
Bhanu Muramalla
2020-9-16
Hi,
States and values can be set using the parameter ‘States’. You can refer to this documentation for more information. Hope it will help!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Environment Customization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!