I have some data generated in MATLAB that I want to process using Perl. I saved the data from MATLAB in a .mat file. Is there any way to read it in Perl?
+1
A:
The Java library JMatIO has worked well for me. Maybe you can try using inline Java.
weiyin
2010-04-07 16:21:59
That sounds like a good idea, except I don't know Java at all :-(
Nathan Fellman
2010-04-07 16:25:01
+4
A:
One option would be to save the binary MAT file as ASCII from inside MATLAB using something like:
load('test_data.mat');
save('test_data.asc', 'var1', 'var2', '-ascii');
Then you would have ASCII data to process in Perl.
If you need a solution completely written in Perl, then you should be able to automate the process using the Math::MATLAB package on CPAN.
NOTE: If Python is an option, you could use the loadmat
function in the SciPy Python library.
Tim Henigan
2010-04-07 16:45:55