In python, I am writing a code that at some point takes a matrix (could be a vector) X and considers it's dimension, since I want to store each dimennsion in variables $m$ and $n$ respectively. If the matrix $X$ is a vector of size $N \times 1$, then np.shape(X)
will return as output (N,)
. However, this information is not helpful, because when I store the information as m,n = np.shape(X)
then I'm gettig the error
ValueError: not enough values to unpack (expected 2, got 1)
Does anybody know how to solve this issue? Ideally I would like to store $m = N, n = 1$, but I don't know how to achieve that. I thought about doing a reshape of my vector, like X = np.reshape(X, (np.shape(X)[0], 1))
but that might cause further issues when going forward with the code. Any suggestions for this? Thanks for all your help!