文章目录
matlab生成的数据是
mat
格式的,需要转换成torch使用的
t7
格式。可以使用
mattorch
实现,但我在OS X 系统中总是安装出错。
matio也可以实现matlab数据和torch数据的转换,matio-ffi
matio
安装
笔主2018年11月按GitHub上步骤安装出错。
#OSX
brew install homebrew/science/libmatio
#Ubuntu
sudo apt-get install libmatio2
luarocks install matio
错误如下:
Error: homebrew/science was deprecated. This tap is now empty as all its formulae were migrated.
出现的原因是homebrew/science的git路径变了(貌似是2018年3月更新)。
这个homebrew community discussion 提到的:
The formulae in Homebrew/science have been copied over (but are not maintained) at https://github.com/brewsci/homebrew-science . A new tap for bioinformatics formulae at https://github.com/brewsci/homebrew-bio.
? brew tap brewsci/bio
? brew tap brewsci/science
? brew untap homebrew/science
最终解决方案:
首先
brew tap brewsci/science
brew install libmatio
最后
luarocks install matio
使用
Load a tensor from matlab array
local matio = require '