Filter löschen
Filter löschen

How to get inport's Bus type assigned for In Bus Element blocks

6 Ansichten (letzte 30 Tage)
Gergely Pekáry
Gergely Pekáry am 18 Mär. 2022
Beantwortet: Gergely am 9 Aug. 2023
How to get inport's data type using the matlab api of an inport assigned to In Bus Element ports?
For example here the ExampleSubsystem is in a Library Model and it has an input defined using the In Bus Element as
(where the ExampleBus is a bus definition present at the base workspace)
My aim is to programatically access/parse the Bus type assigned to the port named InBus (which in this case would be ExampleBus).
In case of regular inports the data type can be accessed easily via the block handle, however, here I can only get the PortName, Element, isBusElementPort properties... but not the Bus type name.
I know the "model" could be compiled and then I could access the CompiledPortDataTypes property, but this is not an option for me as I want to parse subsystems inside library models.
The very reason I would like to do this programatically is to build a harness model for the subsystem and I need the data type that I have to connect to the port InBus.

Antworten (1)

Gergely
Gergely am 9 Aug. 2023
I had the same issue.
The workaround is to programmatically clear the selected 'Element', and then the 'OutDataTypeStr' will be the bus type. Then you can restore the element.

Kategorien

Mehr zu Subsystems finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by