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!