Find name of MPT signal of input line
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Kaustubha Govind
2012-8-27
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!