Elementwise Array handling in Simulink

3 Ansichten (letzte 30 Tage)
Keshav Kumar
Keshav Kumar am 14 Dez. 2018
Bearbeitet: Keshav Kumar am 14 Dez. 2018
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?

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by