4

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?

Adam Soffer
  • 1,614
  • 5
  • 20
  • 36

2 Answers2

5

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!

peterSO
  • 158,998
  • 31
  • 281
  • 276
1

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250