Detecting Bus Selector missing input signal
4 次查看(过去 30 天)
显示 更早的评论
Dear All, I have a bus selector,in which some of the input signals to the bus selector are selected as bus selector output signals already.But at a later point of time,I delete one signal from the bus creator which fed to the bus selector.
So at the bus selector output,the deleted signal will be shown as "???xxx" (consider xxx is the already selected signal).
If I read the output signals of the bus selector by get_param function,still I get signal xxx.
I want to know how to detect this missing input signal "???xxx" from command window.
Any help will be highly appreciated.
0 个评论
回答(1 个)
goerk
2015-9-29
a fast hack is shown in this code snippet:
busselectors = find_system(gcs, 'FindAll', 'on', 'BlockType', 'BusSelector')
for i=1:length(busselectors)
%detection
outputSignals_str = get_param(busselectors(i),'OutputSignals');
outputSignals = strsplit(outputSignals_str,',');
inputSignals = get_param(busselectors(i),'InputSignals');
isValidSignal = false(size(outputSignals));
for j=1:length(outputSignals)
isValidSignal(j) = sum(strcmp(inputSignals,outputSignals(j)))>0;
end
%eg. remove the not valid signals
validOutputSignals = outputSignals(isValidSignal);
validOutputSignals_str = strjoin(validOutputSignals,',');
set_param(busselectors(i),'OutputSignals', validOutputSignals_str);
end
2 个评论
goerk
2015-9-30
Hi Rajesh,
for nested busses the idea is the same, but as inputSignals you get a cell array instead of a string. With a bit of work it should be possible to generate the strings out of it (eg. nestedBus.sig01). With this strings the rest can be performed with the code from above.
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!