numpy 和 matlab 的 reshape


numpy


>>> import numpy as np
>>> a=np.array([1,2],[3,4])

array([[1, 2],
        [3, 4]])

>>> np.reshape(a,(1,4))

array([[1, 2, 3, 4]])


matlab


>> a=[1,2;3,4]

a =

     1     2
      3     4

>> reshape(a,1,4)

ans =

     1     3     2     4

posted @ 2020-05-19 11:03  雪夜羽  阅读(261)  评论(0编辑  收藏  举报