I am trying to access the array soc out the for loop. Outside of the for loop, it gives me only last value. How to access whole soc array out of the for loop?
If I used append method it gives follow error " 'numpy.ndarray' object has no attribute 'append' "
Thank you.
Here is part of my code
for k in range(1,len(t)):
soc =i[k]*(t[k]-t[k-1])/3600*1/(cell_capacity)
soc = soc.append(k)
I tried using append method but it give the error " 'numpy.ndarray' object has no attribute 'append' "
CodePudding user response:
You can add break statement in the for loop and access the soc out side the for loop. You can keep the entire for loop in 1 function and pass the range value say (k,len(t)) once come out after break.
CodePudding user response:
If I replace soc =i[k](t[k]-t[k-1])/36001/(cell_capacity) by soc=i[k](t[k]-t[k-1])/36001/(cell_capacity).
And then do np.cumsum.soc outside the loop then it solves the problem for me.
It is "a" solution for me to proceed further.