필터 지우기
필터 지우기

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

조회 수: 6 (최근 30일)
Gergely Pekáry
Gergely Pekáry 2022년 3월 18일
답변: Gergely 2023년 8월 9일
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.

답변 (1개)

Gergely
Gergely 2023년 8월 9일
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.

카테고리

Help CenterFile Exchange에서 Subsystems에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by