【问题标题】:how to reshape the matrix using matlab or python如何使用matlab或python重塑矩阵
【发布时间】:2017-07-24 23:06:36
【问题描述】:

我有 mat 文件,包括 22544384 * 63 array512*512*86的矩阵

我想将此数组转换为512*512*86*63

如何转换这些数据?

【问题讨论】:

  • 你想要 Matlab 还是 python 中的答案?你试过用谷歌搜索怎么做吗?

标签: python arrays matlab matrix


【解决方案1】:

在 Python 中,如果 'a' 是矩阵的名称,则可以使用:

from scipy.io import loatmat, savemat

data = loadmat('data.mat')
a = data['a']
a = a.reshape(512,512,86,63)
data['a'] = a
savemat('data.mat',a)

【讨论】:

  • 非常感谢!它被创建类型错误(reshape() 需要 2 到 3 个位置参数,但给出了 5 个)
猜你喜欢
  • 1970-01-01
  • 2023-03-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-24
  • 2017-12-25
相关资源
最近更新 更多