Given a matrix A and B of same size, i would like to construct the C matrix of same size, such that it satisfies the below constraint.
- if a_ij = 0 then c_ij = min(0,b_ij)
- if a_ij = 1 then c_ij = max(0,b_ij)
- if (a_ij <> 0 and a_ij <> 1) then c_ij = b_ij.
where a_ij is the i-th and j-th entry of A matrix.
The entries in the A matrix are between 0 and 1.
How optimally we can implement this in matlab. The one i implemented has lot of variables and confusing for me.
1 Answer