我有一个.mat
文件,我使用它加载scipy
:
from oct2py import octave
import scipy.io as spio
matPath = "path/to/file.mat"
matFile = spio.loadmat(matPath)
我得到一个 numpy 数组,我想使用它传递给 octave 函数oct2py
,如下所示:
aMatStruct = matFile["aMatStruct"]
result = octave.aMatFunction(aMatStruct)
但我收到以下错误:
oct2py.utils.Oct2PyError: Datatype not supported
似乎是由于 array dtype
,它看起来像:[('x', 'O'), ('y', 'O'), ('z', 'O')]
因此,我考虑将其更改为'S'
,'U'
或受支持的内容。
- 怎么做到呢?
- 我在otc2py 文档中找不到受支持的dtype 。有什么帮助吗?
- 有没有办法
.mat
用另一个(支持的)dtype 加载文件?我看了这里,但找不到任何有用的东西。
请注意,aMatFunction
它的内部使用aMatStruct
是这样的:x = aMatStruct.x
.