Clear Filters
Clear Filters

Find the mean from a mat file

5 views (last 30 days)
Viktoriya
Viktoriya on 30 Nov 2022
Answered: Nihal Reddy on 14 Feb 2023
I have a large mat file that looks like that:
The first row is the year from 1975 to 2016, the second is month, and the third is the day, the others are different locations, from column 4 onward it is the daily temperature. With that i need extract mean monthly temperature, extreme minimum monthly temperature (the daily temperature in the coldest day of the month), and extreme maximum monthly temperature (the daily temperature of the hottest day of the month), of one specific location (on row 67).
Here is what i have so far, and i dont know what to do next:
s =load('data_sectionM.mat') ;
year=SECTION_M(1,:);
month=SECTION_M(2,:);
day=SECTION_M(3,:);
temp=SECTION_M(67,:);
mydata=[year, month, day, temp];
A=mydata;
for i=1975:2016
for j=1:12
c={i,j,temp}
end
end

Answers (1)

Nihal Reddy
Nihal Reddy on 14 Feb 2023
First you need to use indexing to index the monthly data. Then use the "mean" function to find the mean monthly temperature, "min" function to find extreme minimum monthly temperature and "max" function to find extreme maximum monthly temperature.
Refer to the following documentation links for more information regarding these functions-

Categories

Find more on MATLAB Report Generator 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!