Naming of bus elements using a cell-array of names
1 view (last 30 days)
Show older comments
I want to access the vector output of an S-function as a bus. For this, I'm using a Demux to give labels to each element and then a BusCreator to create the bus. The question now is, how can I assign the channel names in the Demux outputs with commands using a list of names? Or is there a better way altogether?
There is a property of the Demux block called 'OutputSignalNames', which are the current names, but that is read-only.
0 Comments
Answers (2)
Shivam Chaturvedi
on 1 Mar 2016
Edited: Shivam Chaturvedi
on 1 Mar 2016
Hi Thomas,
Instead of using OutputSignalNames, you can use the PortHandles parameter, and get the handles to the individual signals and assign the Name property to each of the signals individually.
here's an example:
% assuming you had the handle of the demux block in a variable called 'demuxhandle'
hPorts = get_param(demuxhandle, 'PortHandles');
outputPorts = hPorts{1}.Outport;
% assuming you had just 2 outports
signalnames = {'a', 'b'};
firstPort = outputPorts(1);
set_param(firstPort , 'Name', signalnames{1})
secondPort = outputPorts(1);
set_param(secondPort , 'Name', signalnames{2})
Hope this helps!
0 Comments
See Also
Categories
Find more on Sources 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!