Vermillion Vermillion - 1 month ago 10
Python Question

Create n x n cell of vectors in python

In Matlab, I have a 9x9 cell variable, where each cell element contains a column vector.

How can I implement this in Python, using numpy?

Answer

You can make a numpy array of python objects like this:

import numpy
a = numpy.empty((9,9),dtype='object')
a[0,0] = numpy.array([1,2,3,4])
a[0,1] = ...
Comments