Elementwise Array handling in Simulink
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!