Is it possible to get block handles instead of port handles in get_param?

조회 수: 20 (최근 30일)
Bibigul Shektybayeva
Bibigul Shektybayeva 2017년 5월 3일
댓글: Mrunal Patil 2020년 3월 6일
I have a simulink model, I need the block handles of the output ports of a subsystem, but when I use get_param it returns different handles. Is there a way to get the block handles from this function, the ones that are returned by gcbh?
blckPortHandles = get_param(sys, 'PortHandles');

답변 (2개)

Rashmi Bharadwaja
Rashmi Bharadwaja 2017년 5월 4일
Block handles can be obtained by using the parameter 'PortConnectivity'.
blckHandles = get_param(gcbh,'PortConnectivity') returns structures containing source and destination handles of all blocks.
blckHandles = get_param(gcbh,'Handle') also returns the handle of each block.
I hope this helps.
  댓글 수: 1
Bibigul Shektybayeva
Bibigul Shektybayeva 2017년 5월 4일
Thanks, but, unfortunately, it is not what i was looking for. The functions you suggest return the same thing , i think it is called port handle, and what i need is block handle, which is returned when you call gcbh, when the port is selected.

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


ES
ES 2017년 8월 2일
Port handles are the handles of the ports(the small > at the border of the subsystem). These are NOT the outports' block handles.
To get the outport handles, first find the outports within the subsystem (using find_system) second use, get_param(blockName, 'Handle')
example:
allOutports = find_system(sys, 'BlockType', 'Outport');
allOutportsHandles = get_param(allOutports, 'Handle');
  댓글 수: 1
Mrunal Patil
Mrunal Patil 2020년 3월 6일
Hey ES, I used ur logic inorder to get the Outports' block handles, but when I'm doing find_system, I'm just getting 0x1 cell, but I actually have 9 ports connected

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

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by