Simulink elementwise switch for vector sample
Show older comments
Hi all,
my probelm:
a, b, and c all are of size [nx1]. a contains data, b is a control-vector and c the output.
I want to implement a logic into my simulink system which functions as follows:
Output should initially be zeros(length(a)). If b(1) turns to true -> c = [a(1), zeros(length(a)-1)]. So basically, for each input-element of a, there is one control-element in b. If the element-specific control-element truns true, the output of the system should become a for that specific element and remain 0 for the rest. The size of n is constant during each simulation but can be initiated differently.
Moreover, once an elemnt of c becomes a, it should remain so until the rest of the simulation even in case b turns false during that time.
I am new to simulink so this is maybe an easy question but even so I am getting a bit frustated at this point. Thank you a lot in advance!
Accepted Answer
More Answers (0)
Categories
Find more on Discontinuities in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


