Sep-18-2020, 02:58 PM
I have this Matlab code
T = L(find(ismember(L+1,L)));
and I want to replicate it into Python.
This is my L array
While correct result should be
T = L(find(ismember(L+1,L)));
and I want to replicate it into Python.
This is my L array
L = np.array([ 1, 3, 5, 7, 12, 13, 14, 15, 16, 17, 18, 24, 25, 27, 29, 30, 31, 32, 33, 35, 36, 38, 41, 43])I went for steps, translating first ismember(L+1,L) with
w = np.in1d(L+1, L)Now for the rest I tried
T = L[np.where(w[w is True])]but I get
[ ]as result.
While correct result should be
11, 12, 13, 14, 15, 16, 23, 28, 29, 30, 31, 34