我相信这是一个简单的问题,但我一直没有找到明显的解决方案。我有一系列由Matlab生成的模型输出数组文件(维度为180、360、12),我需要在R中打开。
我尝试使用R.matlab包,只使用readMat命令,结果得到一个列表对象。将该列表写入矩阵会导致内存分配错误。
我已经尝试过使用unlisting,但没有任何帮助。
如何打开这些Matlab矩阵文件并将其作为矩阵写入R?有什么想法吗?
到目前为止,用于读取Matlab的代码非常简单:
> data<-readMat("filename")
> typeof(data)
[1] "list"
> str(data)
List of 1
$ pco2: num [1:180, 1:360, 1:12] NaN NaN NaN NaN NaN ...
- attr(*, "header")=List of 3
..$ description: chr "MATLAB 5.0 MAT-file, Platform: GLNXA64, Created on: Thu Jul 26 10:36:42 2012 "
..$ version : chr "5"
..$ endian : chr "little
typeof(my_matrix)
。 - Carl Witthoft