mat.h is a header file which comes with MATLAB. I don't think the license 
allows redistribution, and you would not be able to compile without the MATLAB 
libraries.

An alternative may be Octave since it will read .mat files. Perhaps someone can 
email the name of the header file used from the Octave distribution?

http://stackoverflow.com/questions/9915658/how-do-you-open-mat-files-in-octave

This also offers a viable way to test this type of code for those who don't 
have MATLAB.

Dale Smith, Ph.D. | Data Scientist | nexidia | office: +1 404 495 7220 ext 4008 
| fax: +1 404 495 7221 | nexidia.com


-----Original Message-----
From: rcpp-devel-boun...@lists.r-forge.r-project.org 
[mailto:rcpp-devel-boun...@lists.r-forge.r-project.org] On Behalf Of Christian 
Gunning
Sent: Wednesday, March 25, 2015 8:08 AM
To: rcpp-devel@lists.r-forge.r-project.org
Subject: [Rcpp-devel] R.e. Using Rcpp and MATLAB MAT-File API to Read MAT Files

Can you provide a link to the mat.h file referenced in the source (which I 
assume is the same as the API mentioned below)?

Also, see Dirk's comments about compilers here:
http://stackoverflow.com/questions/10723165/using-visual-c-with-r
and here:
dirk.eddelbuettel.com/code/rcpp/Rcpp-FAQ.pdf

Best,
Christian

> I'm trying to use the MATLAB Mat-File API to read data from MAT files 
> into R. (I've tried using the R.matlab package, but the matrices I'm 
> loading can be very large, and that method was too slow. In addition, 
> some of the files I'm loading are v7.3 MAT files, which are not 
> supported by the package.) I wrote the following simple function to 
> start testing. It works fine if I compile without the Rcpp parts in 
> Visual Studio (i.e. I can call matOpen and get a nonzero pointer), but 
> when I run in R it crashes my R session without displaying "Test".
>
> #include <Rcpp.h>
> #include "mat.h"
>
> using namespace Rcpp;
>
> // [[Rcpp::export]]
> NumericVector rcpp_mat_load() {
>
>     MATFile* mf = matOpen("z:/temp/test.mat", "r");
>     printf("Test\n");
>     double val = 10;
>     NumericVector y = NumericVector::create(val);
>     return y;
> }

--
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to