How to retrieve the datatype of the Bus from the "In Bus Element" block programmatically?
4 views (last 30 days)
Show older comments
MathWorks Support Team
on 7 Aug 2023
Answered: MathWorks Support Team
on 16 Apr 2024 at 15:26
I want to retrieve the datatype of the Bus in the "In Bus Element" block programmatically using "get_param" from the following Simulink model "myModel.slx":
I am using the following command to retrieve the datatype of the Bus:
>> get_param('myModel/BusElementIn', 'OutDataTypeStr')
However, this returns the datatype of the element "a" of the Bus, not the datatype of the Bus itself.
Accepted Answer
MathWorks Support Team
on 7 Aug 2023
In your model, "BusElementIn" refers to the individual input Bus element. To retrieve the datatype of the top level Bus port, please refer to the name of the Bus, "InBus":
>> get_param('myModel/InBus', 'OutDataTypeStr')
ans =
'Bus: MyBus'
You can also retrieve the datatype of the element "a" of the Bus with the following:
>> get_param('myModel/InBus.a', 'OutDataTypeStr')
ans =
'single'
By specifying a combination of the model component and the element label, you can change the value of an attribute of an existing top-level bus, nested bus, signal, or message at a bus element port. More information can be found in the documentation linked below:
0 Comments
More Answers (0)
See Also
Categories
Find more on Composite Interfaces in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!