I have the following Matlab code and im trying to write that in python but in Python i can't call ,, i ,, like in Matlab.
Is there a way to write that in Python?
for i=1:np-1
ip1=floor(xp(i)*(nx-1)) 1;ip2=floor(xp(i 1)*(nx-1)) 1;
jp1=floor(yp(i)*(ny-1)) 1;jp2=floor(yp(i 1)*(ny-1)) 1;
CodePudding user response:
I don't think you tried very hard.
for i in range(np):
ip1 = int( xp[i] * (nx-1)) 1
ip2 = int( xp[i 1] * (nx-1)) 1
jp1 = int( yp[i] * (ny-1)) 1
jp2 = int( yp[i 1] * (ny-1)) 1
Of course, the loop is kind of useless because the four variables are overwritten each time through the loop.
