I have an numpy array of shape 24576x25 and i want to extract 3 array out of it. Where the first array contains the every 1st,4th,7th,10th,... element
while second array contains 2nd,5,8,11th,... element and third array with 3rd,6,9,12th,...
The output array sizes would be 8192x25.
I was doing the following in MATLAB
c = reshape(a,1,[]);
x = c(:,1:3:end);
y = c(:,2:3:end);
z = c(:,3:3:end);
I have tried a[:,0::3] in python but this works only if i have array of shape divisible by 3. What can i do?
X,Y = np.mgrid[0:24576:1, 0:25:1]
a = X[:,::,3]
b = X[:,1::3]
c = X[:,2::3]
does not work either. I need a,b,c.shape = 8192x25
a[:, ::3]should be ok. Isaa numpy.ndarray ?a[0::3]. @bigbounty answer definitely works.