Is it possible to read .mat files in Go?

huangapple go评论96阅读模式
英文:

Is it possible to read .mat files in Go?

问题

我想使用Go加载一个存储有4个字段的1x1结构的MATLAB文件。我还没有找到与Python的SciPy相似的东西,它有一个"loadmat"函数。在Go中读取.mat文件的最佳方法是什么?

英文:

I'd like to load a MATLAB file that stores a 1x1 struct with 4 fields using Go. I haven't found anything comparable to Python's SciPy which has a "loadmat" function. What is the best way to read .mat files in Go?

答案1

得分: 5

你可能需要编写自己的Go包。MathWorks建议你使用他们的MATLAB MAT文件C API进行接口。在Go中使用cgo来实现这一点。

参考资料:

MATLAB MAT-File Format - MathWorks

Command cgo

C? Go? Cgo!

英文:

You may have to write your own Go package. MathWorks suggests that you interface with their MATLAB MAT-file C API. To do that in Go, use cgo.

References:

MATLAB MAT-File Format - MathWorks

Command cgo

C? Go? Cgo!

答案2

得分: 1

不,目前似乎没有纯Go语言的用于读取MalLab文件的项目(在CGo中有,参见PeterSO答案):

此外,在“Go矩阵库”中也提到了性能考虑。讨论更多关于从Matlab调用Go的问题

英文:

No, there doesn't seem to be any project for reading MalLab files in pure Go (in CGo, see PeterSO's answer):

And, there were performance consideration as well, mentioned in "Go matrix library".
The discussion was more about calling go from Matlab.

huangapple
  • 本文由 发表于 2014年10月24日 21:37:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/26549014.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定