# Matlab .mat <= v7.3
x <- matrix(1:16, 4)
f <- tempfile()
R.matlab::writeMat(con = f, x = x)
read_mat(f)
# Matlab .mat >= v7.3, using hdf5
# Make sure you have installed hdf5r
if( dipsaus::package_installed('hdf5r') ){
f <- tempfile()
save_h5(x, file = f, name = 'x')
read_mat(f)
# For v7.3, you don't have to load all data into RAM
dat <- read_mat(f, ram = FALSE)
dat
dat$x[]
}
Run the code above in your browser using DataLab