How to transfer data to excel and find average for the data?

I have rainfall data for 3 cities in a state for 365 days in an excel file(so 1 column with the dates and 3 columns with the corresponding rainfall for each city) .How do I transfer them to MATLAB and calculate the mean rainfall for the state? so at the end i would get 1 value for the rainfall of the whole state.Thank you.

Réponses (1)

Try this:
[numbers, strings, raw] = xlsread(filename); % "numbers" is the rainfall data
cityMeans = sum(numbers, 1);
You probably cannot extrapolate the mean of a city to the entire state since cities almost always have very different rainfalls. If you want, you can use mean() instead of sum() -- it just depends if you want the mean per measurement period, or if you want the total sum over all measurement periods.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by