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!