Skip to content
Advertisement

Saving Numpy array using scipy.io.savemat MATLAB does not produce the necessary .mat file

I have written a function to convert a NumPy array into a mat file using scipy.io.savemat() but it produces a generic type of file: File with the same name but not of type .mat as expected. The array I want to save is of type <class ‘numpy.ndarray’> as verified by the print statement. I don’t know what may be the issue.

JavaScript

Advertisement

Answer

Refering to the documentation, I think that you should add ‘.mat’ to the filename (which is the file_path in your case). By replacing

JavaScript

with

JavaScript

Your problem should be solved.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement