Detecting Bus Selector missing input signal
3 ビュー (過去 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.
参考
カテゴリ
Help Center および File Exchange で View and Analyze Simulation Results についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!