Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

refresh numpy array in a for-cycle

Hi experts!

Im writing a code with a numpy array L, the numpy matrix M and the next script:

for x in L: for l in srange(N): z= l in L
if z is False and M[x,l] != 0:
L=np.append(L,l)

here, in the end of the cycle, new elements are incorporated to the array 'L'.

I want these new elements be considered as 'x' index in the cycle.

When I execute the script I see that only the 'originals' elements of L are considered as 'x'.

How can i fix it?

Waiting for your answers.

Thanks a lot!

click to hide/show revision 2
No.2 Revision

refresh numpy array in a for-cycle

Hi experts!

Im writing a code with a numpy array L, the numpy matrix M and the next script:

for x in L:
    for l in srange(N):
        z= l in L 
if z is False and M[x,l] != 0:
L=np.append(L,l)

L=np.append(L,l)

here, in the end of the cycle, new elements are incorporated to the array 'L'.

I want these new elements be considered as 'x' index in the cycle.

When I execute the script I see that only the 'originals' elements of L are considered as 'x'.

How can i fix it?

Waiting for your answers.

Thanks a lot!