Get the port handle for the reference mode
Show older comments
Hello All
Is there anyway to get the port handler for the reference model and then for Inport/Outport read the resolved signal ?
Answers (2)
Fangjun Jiang
on 2 Feb 2022
0 votes
I would think that you porbably need to follow the Model block, open the referenced model and then get the input and output port handels and then the resolved signal object/names.
The info is saved in the referenced model. The referenced model is not loaded when barely open the top-level model.
1 Comment
Mohamed Hamed
on 7 Feb 2022
Mohamed Hamed
on 6 Feb 2022
5 Comments
Fangjun Jiang
on 7 Feb 2022
Once you get the block handle, get its line handles. For Inport block, then check the lh.Outport line handle
>> lh=get(gcbh,'LineHandles')
lh =
struct with fields:
Inport: []
Outport: 104.0001
Enable: []
Trigger: []
State: []
LConn: []
RConn: []
Ifaction: []
Reset: []
>> get(lh.Outport,'Name')
ans =
'SignalLabel'
Mohamed Hamed
on 7 Feb 2022
Fangjun Jiang
on 7 Feb 2022
It needs to be done within the referenced model itself. The line handles of the Inport and Outport blocks.
Mohamed Hamed
on 7 Feb 2022
Fangjun Jiang
on 7 Feb 2022
See my original answer. Forget about the "Model" block. Open the model and start from there.
Categories
Find more on Programmatic Model Editing 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!