May-17-2020, 03:43 PM
I would like to get a maximum of a matrix in intervals inside for loop.
Matrix K has dimension (N,3,3). I like to have a matrix P (Max of K) between N 1 to 10, and then update it again with K and find the maximum at N 10 to 20.
So far I can get the maximum of the matrix K but can't update it in each interval.
Thanks in advance.
Matrix K has dimension (N,3,3). I like to have a matrix P (Max of K) between N 1 to 10, and then update it again with K and find the maximum at N 10 to 20.
So far I can get the maximum of the matrix K but can't update it in each interval.
Thanks in advance.
L=3 N=30 Interval=10 VB=[] for nstep in np.arange(N): V=[] for i in range(0,L): U=[] for j in range(0,L): m=i+4*(i)*j*nstep-5*j*i U.append(m) V.append(U) VB.append(V) K=np.array(VB) P=np.zeros((1,L,L)) for i in range(0,N): for j in range(0,L): for k in range(0,L): if (K[i][j][k]>P[0][j][k]and(i%interval!=0)): P[0][j][k]=K[i][j][k]