Elementwise Array handling in Simulink

조회 수: 3 (최근 30일)
Keshav Kumar
Keshav Kumar 2018년 12월 14일
편집: Keshav Kumar 2018년 12월 14일
How to implement the following in Simulink?
I know it's easy in MATLAB but I need to do it in Simulink because I'll be generating code afterwards through Targetlink. I have two arrays.
InputSignal = %Array of 10 values. Eg. (rand(10,1))'
Configuration = %Array of 6 0s and 4 1s. Basically it is used to decide which corresponding value should be taken from the InputSignal.
OutputSignal = zeros(1,4); %Here we store those 4 values from InputSignal whose corresponding values in Configuration is 1.
j = 1;
for i = 1:10
if (Configuration(i) ~= 0)
OutputSignal(j) = InputSignal(i);
j = j+1;
end
end
How do I do it in Simulink?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by