Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

The Java library JMatIO has worked well for me. Maybe you can try using inline Java.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top