I need to write a programme in MATLAB to convert my daily rainfall data into average rainfal per month. I have thousands of entries so doing this manually in Excel is a no go. Does anybody know how I can go about this? I am stumped!
ok great I could use access.Can't help you to do it in MATLAB, but it would be easy to acheive using MS Access and the original data (I'm assuming it's in excel) as the source.
If that's any use, let me know and I'll post some examples of how to do it.
Ok, assuming the data is in a format something like.
Location - Date - Rainfall
First thing is to link the data as a table. Go to tables, right click, link table and select the data source.
Then go into query builder and create a new query with the following fields.
Location - =month(date) - rainfall
This will give you the location, the month and the rainfall for each day.
Then create a second query (you can use the query wizard for the one) and create a summary query based on the query you have just made. Choose average for rainfall in summary options, and then group by location and month.
Run that query, and you'll produce a list of average monthly data for each location.
If that's ok, let me know, if you don't understand, let me know and I'll try and break it down simpler, or let me know the data structure and I'll see what I can put together for you.
Thanks a lot. My data is in this format: date (in column 1) and rainfall (in column 2). Would this alter it much?
hmmm, odd. I have no idea why it's doing that.
Do you just need the output? if so I'll export it to excel and send it to you, if not, I'll copy the SQL and send that to you to recreate the query yourself.
If you could send me the SQL that would be great.
SELECT DISTINCTROW Format$([FR94300].[F1],'mmmm yyyy') AS [F1 By Month], Avg(FR94300.F2) AS [Avg Of F2]
FROM FR94300
GROUP BY Format$([FR94300].[F1],'mmmm yyyy'), Year([FR94300].[F1])*12+DatePart('m',[FR94300].[F1])-1;