I want to compare every element of two matrices with the same dimensions. I want to know, if one of the elements in the first matrix is smaller than another with the same indices in the second one. I want to fill a third matrice with the values of the first, but every entry, where my criteria applies, should be a 0. Below I will show my approach:
a = ([1, 2, 3], [3, 4, 5], [5, 6, 7])
b = ([2, 3, 1], [3, 5, 4], [4, 4, 4])
c = np.zeros(a.shape)
for i, a_i in enumerate(a):
a_1 = a_i
for i, b_i in enumerate(b):
b_1 = b_i
if a_1 < b_1:
c[i] = 0
else:
c[i] = a_1
I am very sorry if i made any simple mistakes here, but i am new to python and SO. I found some posts on how to find entrys that match, but I dont know if there is a solution where could use that method. I appreciate any help, thank you.