Skip to content Skip to sidebar Skip to footer

Getting A Matlab Code's Results On Python

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?

Solution 1:

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

Solution 2:

A .dat file is just a text file:

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

Post a Comment for "Getting A Matlab Code's Results On Python"