Find name of MPT signal of input line
3 views (last 30 days)
Show older comments
I have a large Simulink model which includes many signals associated with mpt.Signal objects in the base workspace (so that these lines auto code to simple, non-structured variables). To create some ancillary information for this model, I need my script to find which mpt signals are used as inputs to some of my custom subsystem blocks.
Looking at one of these blocks, I can use "get_param" to get its inport "Port" and "Line" object handles, but I cannot find a way to retrieve the name of the associated MPT signal.
Alternatively, my script has a list of these signals available. If I could generate a list of every subsystem inport which uses a given MPT signal, then I could search that list for the subsystems which intrest me, and complete my script from there.
So is there any way for a script to find the uses of an MPT signal, even after it is routed through multiple subsystem levels of a complex madel? I could use a solution which either examines an inport and determinies the signal or finds all inports which use a given signal.
0 Comments
Answers (2)
Kaustubha Govind
on 27 Aug 2012
This might help:
>> signals = find_system('modelname', 'FindAll', 'on', 'RegExp', 'on', 'Type', 'line', 'Name', '\w')
This should give you the list of all signals with a non-empty name.
Alternately, if you have the line handle, you should just have to call GET_PARAM to ask for the "Name" parameter:
>> get_param(signals(1), 'Name')
You can also use "get" instead of get_param. The following command will query for all public properties of the line:
>> get(signals(1))
0 Comments
See Also
Categories
Find more on Subsystems in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!