convert to monthly mean (arrange data)
Show older comments
I attached here 2 text files ..one is input file(complete data of year,month number,Day1 to day31) and second one is output file(year, month wise mean).I want this output format only.
6 Comments
Guillaume
on 22 Sep 2014
What is the difficulty you're facing? Looks as simple as averaging column 3 onwards of each row.
skyhunt
on 22 Sep 2014
Geoff Hayes
on 22 Sep 2014
Start with importdata to load the data from each file into local variables (structures). The data field of each of these structures will have the numeric data. As some of your columns (for certain rows) are empty, then these will be replaced with NaN.
Then as Guillaume suggested, take the average of each row (only from the input.txt file) from the third column onwards. If you have the Statistics Toolbox, consider using nanmean which will take the average of a set of numbers, ignoring any Nan values. If you don't have this function, then you can write an equivalent version using mean as a guide.
skyhunt
on 23 Sep 2014
Geoff Hayes
on 24 Sep 2014
What happened when you loaded the data from file using importdata? Please post some or all of the code that you have written to accomplish this task.
Accepted Answer
More Answers (0)
Categories
Find more on Dates and Time in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!