On Jan 28, 2010, at 10:42 AM, Gopikrishna Deshpande wrote:
Hi,
I have a matrix of size 19x512x20 in R.
No, you don't. Matrices are only 2 dimensional in R. You may have an
"array", however.
I want to export this file into
another format which can be imported into MATLAB.
write.xls or write.table exports only one dimension.
please send a code if possible. I am very new to R and have been
struggling
with this.
install.packages(pkgs="R.matlab", dependencies=TRUE)
library(R.matlab)
?writeMat
filename <- "~/test.mat"
writeMat(filename, arr=arr)
> readMat(filename)
$arr
, , 1
[,1] [,2] [,3]
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9
, , 2
[,1] [,2] [,3]
[1,] 10 13 16
[2,] 11 14 17
[3,] 12 15 18
, , 3
[,1] [,2] [,3]
[1,] 19 22 25
[2,] 20 23 26
[3,] 21 24 27
attr(,"header")
attr(,"header")$description
[1] "MATLAB 5.0 MAT-file, Platform: unix, Software: R v2.10.1, Created
on: Thu Jan 28 12:08:25 2010 "
attr(,"header")$version
[1] "5"
attr(,"header")$endian
[1] "little"
Thanks !
Gopi
[[alternative HTML version deleted]]
______________________________________________
R-help@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.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
R-help@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.