Naming of bus elements using a cell-array of names
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Shivam Chaturvedi
2016-3-1
编辑:Shivam Chaturvedi
2016-3-1
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!