I have a numpy matrix of size 3X3 and I am trying to insert a list into a matrix. But it gives the following error:
ValueError: setting an array element with a sequence.
The following code is here:
for ind1, var1 in enumerate(combined_edges[0]):
for ind2, var2 in enumerate(combined_edges[1]):
t,u, xm,ym,xn,yn,xo,yo,xr,yr, bool = edgeIntersect(var1,var2)
if bool == False:
print("There is no intersection")
intersectMat[ind1][ind2] = 0
else:
t = int(t) if np.asscalar(t).is_integer() else t
u = int(u) if np.asscalar(u).is_integer() else u
alpha = var1[0].point()[0] + t*(var1[1].point()[0] - var1[0].point()[0])
beta = var1[0].point()[1] + t*(var1[1].point()[1] - var1[0].point()[1])
new_node = Node((alpha,beta), mark=True)
print(new_node.point())
intersectMat[ind1][ind2] = array(new_node.point(), dtype=int)
Any suggestion ??