Need help streamlining averaging values from separate csv spreadsheets
I'm analyzing data that I am extracting from simulations at periodic time steps and my data can only be extracted in the form of individual spreadsheets. Each spreadsheet has something like 83,000 rows and 7 columns of values. I have 12 different cases, each with about 100-150 spreadsheets. It would be a waste of time to do it manually.
So for one case I have a directory with text spreadsheets in them. There are 7 columns of data in each spreadsheet, all with tab delimiters.
I want to average the values across all of the files. What i mean is I want the first value of the first column in all 100 files to be averaged together and so on
Shouldn't be terribly hard.
Open file
store all data to matrix
count=count+1
close file
open next file
add to existing matrix
count=count+1
close file
rinse and repeat until all files have been added.
At the end, divide everything by count.
the files are csv files but may be treated as txt files.
they are named as follows:
table5
table10
table15
table20
.....
...
..
.
Any help would be greatly appreciated on this.
|