[R] readMat - how to retrieve the variables

Joshua Wiley jwiley.psych at gmail.com
Sun Mar 13 22:29:33 CET 2011


Hi Ed,

Can you please provide *at least* the R output from running:

str(data)

where "data" is the variable name you stored the results of readMat()
in.  If it is reasonably small and can be sent as plaintext (I do not
know Matlabs file format off hand), you could send us the actual data
so we can try to read it in, but at the least str() will let us see
how R is storing your data and give you some explanation.

Side note, as data() is a function, it might be worthwhile to call
your actual data something else (say, mydata, dat, etc.).  For anyone
else interested, readMat() is in package "R.matlab".

Cheers,

Josh

On Sun, Mar 13, 2011 at 2:07 PM, Eduardo M. A. M.Mendes
<emammendes at gmail.com> wrote:
> Hello
>
> I have a matlab MAT file that contains one single variable: a.  The
> structure of a is as follows:
>
> a.river1.flow (flow values)
> a.river1.date_flow (date)
> a.river1.precip (precipitation values)
> a.river1.date_precip
> a.river2.flow
> a.river2.date_flow
> a.river2.precip
> a.river2.date_precip
>
> I have used readMat to load the variable a in R, however I have no idea how
> readMat translates a.  I managed to get some values out of
> data=readMat("matfile.mat")
>
> data$a[,,1]$river1[,,1]$flow  -> Why do I need [,,1]?  Why not
> data$a$river1$flow?
>
> Many thanks
>
> Ed
>
> ______________________________________________
> 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list