I need to translate a matlab code to python numpy code
I have 4 2-dimension arrays (A, B, C and D) and want to create a new one "res".
the code in matlab
index1 = find(A == 2 & B > C);
index2 = find(A == 2 & B >= D & B <= C);
res = uint8(zeros(100,100));
res(index1) = 5;
res(index2) = 4;
in Python/numpy I figured out I can create new arrays like this:
res = ((A == 2) & (B > C)) * 5
res = ((A == 2) & (B >= D) & (B <= C)) * 4
but how can I combine this 2 results in only one array? Like the matlab code does.