[R] Matlab import

tshort tshort at eprisolutions.com
Tue Apr 10 14:35:41 CEST 2007


With readMat, don't use the "-ascii" option (which you didn't have in your
first posting). I've never tried reading matlab's ascii format. In any case,
readMat reads matlab's binary format. 

- Tom

Tom Short
EPRI


Schmitt, Corinna wrote:
> 
> Hallo,
> 
>>I've used Henrik Bengtsson's R.matlab package several times to
successfully
>>read in matlab data files. It's normally as easy as:
> 
>>library(R.matlab)
>>mats <- readMat("matrixM.txt")
> 
>>- Tom
> 
> I have imported this package, too. And tried your commands with the new
> txt-file as mentioned in my last mail to the mailing list. 
> 
> I get the following error command:
> mats = readMat("Z:/Software/R-Programme/test.dat")
> Error in if (version == 256) { : Argument hat Länge 0
> Zusätzlich: Warning message:
> Unknown endian: . Will assume Bigendian. in: readMat5Header(this,
> firstFourBytes = firstFourBytes) 
> 
> What did I wrong? Please check my txt-file which was constructed with the
> matlab command "save('test.dat','matrixM','-ascii')"
> 
> Thanks, Corinna
> 
> ----------------------------------------------------------------------------
> 
> 
> Schmitt, Corinna wrote:
>> 
>> 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 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. 
>> 
>> The result should be a matrix with the entries as mentioned above.
>> Perhaps I made already an error in matlab. 
>> 
>> 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
>> 
>> MATLAB 5.0 MAT-file, Platform: PCWIN, Created on: Tue Apr 10 13:17:44
>> 2007                                                 
>> �IM���3���xœãc``p�b6 æ€Ò À
>> å31331;ç&–eVø‚ÅAjY˜X™
> �[n|
>> ______________________________________________
>> R-help at stat.math.ethz.ch 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.
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Matlab-import-tf3552511.html#a9918327
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/Matlab-import-tf3552511.html#a9918787
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list