How can the Selector Block work with possibly empty indices?

Long time Matlab user, novice Simulink user here...
I've got a signal containing 'n' number of values. Depending on run-time settings based on a Matlab file that calls the Simulink simulation, the signal may contain some combination of signal groups - call them groups A, B, and C. The signal may or may not contain any or all of these different groups. I need to process these three signals differently, then recombine them into the signal in the original order.
I can identify these groups according to an index array that is solved in the Matlab file, and I can filter out the various groups using the Selector block using those index arrays as arguments. I can then recombine the three signals in the desired order after processing them. Here's the problem...
If the signal doesn't contain a group, then the index array for that group is empty, and the Selector block throws an error. I'd prefer it just create an empty signal branch that recombines with the main branch, but I guess that doesn't work.
What is the most efficient way to do this? Help appreciated.

댓글 수: 1

Prepare two masks signal1_select=[1,1,1,0,0,0,0], signal2_select=[0,0,0,1,1,1,1].
Multiply signals with masks via gains and then add the result via add block.
If no element of a signal is needed, its mask will only contain 0's

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품

릴리스

R2017b

질문:

2018년 10월 18일

댓글:

2025년 9월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by