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?
Asked
Active
Viewed 1,718 times
2 Answers
7
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.

Community
- 1
- 1

Tim Henigan
- 60,452
- 11
- 85
- 78
1
The Java library JMatIO has worked well for me. Maybe you can try using inline Java.

Peter Mortensen
- 30,738
- 21
- 105
- 131

weiyin
- 6,819
- 4
- 47
- 58
-
1That sounds like a good idea, except I don't know Java at all :-( – Nathan Fellman Apr 07 '10 at 16:25