.mat
- это файлы, которые содержат данные, которые могут быть прочитаны Matlab.Если файлы .dat
имеют формат, который также может быть прочитан Matlab, то ваша проблема заключается в простой проблеме переименования файлов.Точнее, измените расширение всех файлов в папке с dat
на mat
.
Код будет выглядеть примерно так:
# Python3 code to rename multiple
# files in a directory or folder
# importing os module
import os
# Function to rename multiple files
def main():
i = 0
for filename in os.listdir("xyz"): #xyz=the folder which has your files
dst ="s0" + str(i) + "lre.mat" #I suppose the numbering of the files begins with 0. This is the name pattern I detected from your screenshot
src ='xyz'+ filename
dst ='xyz'+ dst
# rename() function will
# rename all the files
os.rename(src, dst)
i += 1
# Driver Code
if __name__ == '__main__':
# Calling main() function
main()