How do I populate the signal names to match the bus object signal names in the Bus Creator block in Simulink 6.6 (R2007a)?
5 次查看(过去 30 天)
显示 更早的评论
I want all the signals entering a Bus Creator block to respect the names specified in a bus object. I would like all the names to be automatically assigned to the signals/buses coming into the Bus Creator based on the Bus Object specified.
采纳的回答
MathWorks Support Team
2013-10-18
The ability to assign signal names automatically from the specified Bus Object is not available in Simulink 6.6 (R2007a).
It is possible to create a script that automatically assigns the names specified in the Bus Object Elements to the signals connected to the bus object. For an example, download the attached files MainBus.mat, BusToBeNamed.mdl and DefineInputs.m. The Simulink model contains a Bus Creator block assiciated with a Bus Object. The following example MATLAB code can be used to assign the appropriate names to the signals connected to the bus.
load MainBus
open_system('BusToBeNamed');
S = Simulink.Bus.objectToCell({'MainBus'});
blk = 'BusToBeNamed/Bus Creator';
ph = get_param(blk,'PortHandles');
lh = get_param(ph.Inport,'Line');
N = length(S{1}{4});
for i = 1:N
set(lh{i},'Name',S{1}{4}{i}{1});
end
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!