matio/mattorch

博客介绍了matio库用于在MATLAB和Torch之间转换数据,包括安装遇到的问题及如何加载和保存数据结构。在安装mattorch时,遇到Homebrew科学配方废弃的问题,以及在已安装MATLAB的情况下,CMake配置仍然失败的错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


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


                
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值