I want to find the number of common elements of arr1 (1D) inside arr2 (3D), not using loops.
arr1=[1,2,3];
arr2=[y][x][1,2,3,4,5,6];
(y and x could be any index).
Output: 3.
The thing is to be able to run on MQL5, by importing numPy or similar.
Thanks for your help.
arr1 = np.array([1, 2, 3])
arr2 = np.array([[[1, 2, 3, 4, 5, 6]],
[[7, 8, 9, 10, 11, 12]],
[[3, 4, 5, 6, 7, 8]]])
flatarray = arr2.flatten()
common_elements = np.intersect1d(arr1, flatarray)
a = len(common_elements)
print(a)