I’m trying to write a for loop in python to create an array of tuples that should look like
Output = [(0.0,C[0]),(0.0,C[1]),(0.0,C[2]), .... , (0.0,C[n-1])]
where C is an array of some other numbers.
If I try (something that would work with matlab)
for n in xrange(0,N):
Output[n]=numpy.asarray( [0.0,C[n]] )
then I get the error ValueError: setting an array element with a sequence.
Could anyone help?
How about:
BTW, an “array of tuples” doesn’t make much sense to me. If you mean an object array (maybe a cell array in matlab?) I’d recommend using a list instead of an array.