how to get the names of each signal of a bus signal using MATLAB commands ?

답변 (4개)

Guy Rouleau
Guy Rouleau 2011년 9월 8일

5 개 추천

Since R2010b I think, you can use the "SignalHierarchy" property of a port to get the names of each signal in a bus. fo example, with the demo model 'busdemo', you can do:
busdemo([],[],[],'compile')
ph = get_param('busdemo/Bus Creator', 'PortHandles');
sh = get_param(ph.Outport, 'SignalHierarchy')
See details here:

댓글 수: 3

SHIVA
SHIVA 2011년 9월 9일
In R2009b??
Sebastian
Sebastian 2016년 9월 13일
This is awesome! You made my day! I unsuccessfully tried to figure out, how to find the names from the input signals, but this is just great!
One question: Is it possible that 'SignalHierarchy' is also working without updating/compiling the model? Your code also seems to work without it.
Kanava Pitchai
Kanava Pitchai 2020년 3월 16일
This Syntax is working for Simulink Model.
But for Library Model the 'SignalHierarchy' syntax is not executing. Because in Library model this option 'SignalHierarchy' is disabled.
Any way to get the Parameters of Input Port?
Thanks in advance.

댓글을 달려면 로그인하십시오.

Fangjun Jiang
Fangjun Jiang 2011년 9월 8일

0 개 추천

How is the bus created? Do you want the signal name in MATLAB or Simulink. In Simulink, you can use the Bus Selector block to see the signal names. In MATLAB, maybe use Simulink.Bus.objectToCell
doc Simulink.Bus.objectToCell

댓글 수: 1

SHIVA
SHIVA 2011년 9월 9일
Bus is created using a Bus creator and one of the input to Bus creater is again a bus signal. I want the signal names in MATLAB.

댓글을 달려면 로그인하십시오.

pavan
pavan 2018년 3월 16일

0 개 추천

awesome ! Is there any way to get the 'compiled data types' of these signal hierarchy ? I want to know them so that Simulink object can be created from these children's info.
Please let me know if if I can apply >>get_param(ph.Inports, 'CompiledDataTypes')
this method to signals also.
MC
MC 2021년 4월 2일

0 개 추천

In 2020a if you have a bus selector block connected to the bus you can use its InputSignals parameter. The return value is a cell array with nested cell arrays for nested buses.

카테고리

도움말 센터File Exchange에서 Interactive Model Editing에 대해 자세히 알아보기

질문:

2011년 9월 8일

답변:

MC
2021년 4월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by