I would like to do a data reduction operation on a spreadsheet. Preferably I would like to use MATLAB/(or excel) since I need separate output files for each case.
The link is for the spreadsheet is below
A screenshot of the spreadsheet is as below

The output I required in text files is something as below
The first sheet in the .xls file is the main input. Wheras the the following sheets (d**) are my required output. I also need these sheets in a separate ASCII file (.dat) to plot hem later on. Here is how the algorithm works
- Lookup the number/string in column B(FileName)
- Extract all data in Columns C and D (Saturation and ETC) with same FileName Value(Column B)
- Lookup the matching FileName(Column B) value in Column E (ImageIndex).
- Copy Value of ImageName(Column F) to the corresponding Value in Image(IndexColumn E)
- Result would be three columns (ImageName,Saturation,ETC). ImageName would be same for each subcase
- Sort the columns based on Saturation
- Write each sub case as a separate .dat file
I tried using a few recipes using categorical arrays (findgroups and splitapply) in MATLAB. Didn't seem to work out for me. I would be later working on a larger data set so automation is necessary. I think this could be done using macros on excel, but I would prefer using MATLAB since I would use MATLAB to plot the data. Any other alternative suggestions are welcome
Thanks,