-2

I have code in matlab whose results I would like to use in python code (as a matrix or as a .dat file). Could anyone tell me how this could be done?

2 Answers 2

3

NumPy and SciPy can read and write MATLAB .mat files directly using scipy.io.loadmat and scipy.io.savemat.

Sign up to request clarification or add additional context in comments.

2 Comments

I don't think so. According to the loadmat documentation "we do not implement the HDF5 / 7.3 interface". So I presume not - it's good that you pointed this out.
There are Python modules for reading HDF5, for example this one.
1

A .dat file is just a text file:

fid = fopen('outputFile.dat', 'wt');
fprintf(fid, your_data_in_string_format);
fclose(fid);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.