I am trying to run this code in code in Julia but I keep getting this error which am struggling to correct. syntax: invalid iteration specification
Any help will be much appreciated please. Below is my code:
x = [0, 5, -5, 4, -5] # x cordinates of the circle
y = [0, 0.6, 0.5, -5, -4.5] # y cordinates of the circle
coverage=[[1, 0, 0, 0, 1],[0, 0, 0, 1, 1],[1, 0, 0, 0, 1],[0, 0, 1, 1, 1],[0, 0, 0, 1, 1], [0, 1, 0, 0, 1],[0, 0, 1, 1, 0],[0, 0, 0, 1, 0],[1, 0, 0, 0, 0],[1, 1, 0, 0, 0],[0, 1, 0, 0, 0],[0, 0, 1, 0, 0],[0, 0, 1, 0, 0],[1, 0, 0, 0, 0],[0, 0, 0, 1, 0]]
#A=[[2, 3, 4], [3, 2, 5]]
a=[-1, -1, 1.2, 1.2, 1.2, 0.8, 2.5, 2.5, -3, -3, -1.5, 3, 0.9, -3.7, 3.7] #x cordinate of the points
b=[0.2, 0.8, -0.85, 1.2, 0.5, -1.5, -1.3, 1.4, 1.5, -1.3, -0.8, -2.7, -2.4, 0.5, 0.8] #y cordinate of the points
r=[] # array to store max distances for the center of each circle to each point
#print("A =", A)
print("A =", coverage)
function distance()
for i,xv in enumerate(x):
R=[] # store the distance of each circle i to each point
for j, jv in enumerate(a):
if (coverage[j][i]==1):
R.append( ((x[i]-a[j])**2 + (y[i]-b[j])**2)**0.5)
r.append(max(R)) # find maximum distance from circle i to each point and save in r
# end
return r
distance()