Elementwise Array handling in Simulink
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
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!