‘’‘python实现MATLAB中x(:)功能’’’
import numpy as np
x=np.array([[1,2,3],
[4,5,6],
[7,8,1]
])
print(‘x=’,x)
def anliezhankai(A):
raw=A.shape[0]
Column=A.shape[1]
f = []
for i in range(0, Column):
for j in range(0, raw):
f.append(A[j][i])
f=np.array(f)
f=f.reshape(-1,1)
return f
f=anliezhankai(x)
print(f)
2020-09-14
最新推荐文章于 2024-11-05 15:28:12 发布