Hello Community,
I wonder if you can help with this problem. I have several hundred files all containing various Matlab files eg .fig etc., but only including one saved workspace in each folder as '.mat' files. I have looked all afternoon for a way of searching through all the child folders, extracting 4 variables from the saved workspaces, and then writing them all to an excel spreadsheet (I know I could use a struct - I'm just more comfortable with excel while I continue to learn Matlab!). All the child folders are named numerically, and this is the same name as the workspace in the folder. For example:
- Folder name: 1234, contains
- 1234.mat (the workspace)
- The workspace contains variables: X1 X2 Y1 Y2 (numeric) and newfolder (string)
- Excel spreadsheet named: locations.xlsx
What I would like to happen is the code reads the folder names in order, opens the workspace and extracts the variables, writes them to the excel sheet in the following order; newfolder X1 X2 Y1 Y2, and then moves on to the next folder and repeats the process until all child folders are done.
I would usually post the code I have tried to make but nothing is worth showing as its not even close. I have not used Matlab for a couple of months now and it seems like everything I had learnt before has rapidly disappeared from my brain, so I am rather frustratingly making the same old mistakes again!
If you can offer any help or just pointers to other answers, I would really appreciate the input. Thanks.
Kind regards,
10B.