How to label a signal using a sub-system mask parameter in Simulink?
Show older comments
Hello!
I am working in Simulink and I have a masked subsystem with a string mask parameter. Within the subsystem I want to label a signal based in this parameter. How can I go about doing this? Thank you in advance.
Accepted Answer
More Answers (1)
Paul
on 6 Sep 2024
Hi Kevin,
I was able to change a signal name in the masked subsystem using code in the mask initialization code. In my simple example, I have a masked subsystem with a dialog parameter called sname.
The first line of code gets the handles to the ports of the Gain block. The second line changes the name of the signal output from the Gain block to the string value in the mask dialog for the sname parameter.
ph = get_param([gcb,'/Gain'],'PortHandles');
set_param(ph.Outport,'Name',sname)
I think you should be able to adopt this to your model.
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!
