[R] WG: Matlab import
Schmitt, Corinna
Corinna.Schmitt at igb.fraunhofer.de
Tue Apr 10 14:22:39 CEST 2007
Dear R-Experts,
>here again a question concerning matlab. With the command "matrixM=[1 2
>3;4 5 6]" a matrix under Matlab was constructed. It was than stored
with
>the command "save('matrixM.txt','matrixM')".
now I found my error in the matlab command for storing the data in a txt
file. You need to write "save('test.dat','matrixM','-ascii')" the result
is the new attached file test.dat.
>Now I tried to import the data in R with the help of the command
>"Z=matrix(scan("Z:/Software/R-Programme/matrixM.txt"))"
>An error occurred.
I could import the file to R with the command "
Z=matrix(scan("Z:/Software/R-Programme/test.dat",n=2*3),2,3,byrow=TRUE)"
But this is a spezial case. I specified the number of columns and rows.
How can I do this import without knowing those information?
Has any one got an idea how to import the data and store it in R. In R I
want to make further calculations with the matrix. I just installed
R.matlab but could not find an example with could help me.
Thanks, Corinna
More information about the R-help
mailing list