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.
回答 (1 件)
Image Analyst
2019 年 12 月 23 日
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.
カテゴリ
ヘルプ センター および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!