How do I populate the signal names to match the bus object signal names in the Bus Creator block in Simulink 6.6 (R2007a)?

4 views (last 30 days)
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.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Oct 2013
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

More Answers (0)

Products


Release

R2007a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!