0

I have the following file structure:

dir
|______folder
|      |___file1
|      |___file2...
|
|____script

So script and folder are in the same directory and all the files in folder are .mat files. I just want to import every .mat file in folder into script. I have tried tons of other strategies but for some reason it doesn't like the way I have things set up. Any and all input is appreciated!

stone327
  • 11
  • 3
  • How do you want to import the .mat files, like do you want to read them as text files? or execute code within them? – Raunak Jain Jun 15 '22 at 20:28
  • You can open the files as ```with open("folder\file1.mat") as f: data = readmat(f)``` – Raunak Jain Jun 15 '22 at 20:32
  • You will have to define readmat() by yourself based on your specifications. Check out this question: [Read .mat files in Python](https://stackoverflow.com/questions/874461/read-mat-files-in-python) – Raunak Jain Jun 15 '22 at 20:33

0 Answers0