Hi Alexandros,
In case that I misunderstood your question, I did not provide the complete solution here. But you may find the following tips helpful.
- Tip 1: Use For-each subsystem to operate on array input elementwisely.
- Tip 2: Use blocks from 'Logic and Bit Operations' and 'Switch' block to perform logical operations. In my solution, inside of the For-each subsystem, a switch block is used to set the output (c) value to be either 0 or value in input a.
- Tip 3: Use blocks with states to record previous running status. Unit Delay block is adopted in my solution here to record the value of the rectified control vector 'b_rectify' from the previous run. This vector ensures that the element values remain '1' once it has previously been set to '1' by performing logic or operation with 'OR' block. Make sure yout set the initial condition of Unit Delay block to be the same as the initial value of vector b.
- Tip 4: In the case where control vector is from external source, use 'In1' block to provide a input port. Make sure that the data (vector b) feed to this port has the same dimension as vector a.
Or you can use 'Matlab Function' block and 'S-Function' block to implement your own logic. You should be able to find more instructions and examples in Simulink Documentation,
Hope these tips serve your purpose.