Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我怎样才能写一个MxNx3矩阵。在哪里
MxNx3
a = matrix(((1.4,),(2.5,),(1.96,),(6.25,),(12.25,))) resol_val2 = a.shape
这里resol_val2是(5, 1)。我想写一个在matrix b哪里b.shape(M,N,3)
resol_val2
(5, 1)
matrix b
b.shape
(M,N,3)
如果你使用 numpy,你可以这样做:
>>> a = numpy.array(((1.4,),(2.5,),(1.96,),(6.25,),(12.25,),(10.21))) >>> m = 2 >>> n = 3 >>> b = a.reshape((m,n,1))