I am trying to find suitable python function to replace matlab find in my script and with some google search I see np.where() solves the purpose most of the time. But in case of double condition, I have different outputs. Can someone tell me whats wrong with this approach and how to go ahead? The example code and difference is below.
In case of matlab:
b = [1, 2, 3; 1, 2, 3; 1, 2, 3]
[I, J] = find(( b > 1) & (b <= 3))
Gives output
I = J =
1 2
2 2
3 2
1 3
2 3
3 3
In case of python:
b= array([[1, 2, 3],
[1, 2, 3],
[1, 2, 3]])
>>> np.where((b > 1) & (b <= 3))
(array([0, 0, 1, 1, 2, 2]), array([1, 2, 1, 2, 1, 2]))