Gopikrishna Deshpande
2010-Jun-10 04:54 UTC
[R] importing multidimensional matrix from MATLAB
Hi, Suppose I have a matrix of size 256x14x32 in MATLAB. I want to import that into R. I used readMat and then do.call. But the variable is stored as an array as its done in R. However, I want to define a variable W=array(0,c(256,14,32)) in R and read the multidimensional matlab variable into W. I am not able to do this in R. Please, could you help ? Thanks Gopi [[alternative HTML version deleted]]
Gopi - Not much to go by, but maybe this will be helpful: In matlab:>> themat = rand(10,5,3) >> save thematIn R:> library(R.matlab) > themat = readMat('themat.mat') > dim(themat$themat)[1] 10 5 3 (Since .mat file can store more than one object, readMat returns a list with each object as a named element.) - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spector at stat.berkeley.edu On Thu, 10 Jun 2010, Gopikrishna Deshpande wrote:> Hi, > > Suppose I have a matrix of size 256x14x32 in MATLAB. I want to import > that into R. I used readMat and then do.call. But the variable is > stored as an array as its done in R. However, I want to define a > variable W=array(0,c(256,14,32)) in R and read the multidimensional > matlab variable into W. I am not able to do this in R. Please, could > you help ? > > Thanks > Gopi > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >