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.
import os
import scipy.io
def save_electrode_measurement_to_matfile( measurement: np.ndarray, file_name: str = 'latest_electrode_measurement'):
print(type(measurement))
mdict = { 'electrode_measurement' : measurement}
dir = r"...\Simulation_results"
file_path = os.path.join(dir, file_name)
scipy.io.savemat(file_path, mdict, appendmat = True)