필터 지우기
필터 지우기

I have air temperature dataset obtained in every 30 minutes for a day for a whole year. I want to extract maximum and minimum air temperature for each day for a year (365 days).

조회 수: 8 (최근 30일)
Data=importtemp ('observed.csvc');
Data1=Data ([1:end],1); % air temp
Do=datenum ([2013,0101 000]); date started
Dv=Do + [1/24:1/24:365]'; % number vector
Ds=datestr (Dv,'01.01.2013'); date string
T=([1/24:1/24:365])+randn (size (Dv')); %
Data1={Ds T'}

답변 (2개)

pankaj singh
pankaj singh 2018년 3월 20일
You can separate your data into days and then use max() and min() matlab functions to find the maximum and minimum temperatures.

Akira Agata
Akira Agata 2018년 3월 20일
By using timetable and retime function, you can do that very easily. The following is an example:
% Sample data
Time = (datetime(2017,1,1,0,0,0):minutes(30):datetime(2017,3,31,23,30,0))';
AirTemp = 20 + 10*rand(numel(Time),1);
% Create timetable
TT = timetable(Time,AirTemp);
% Daily min/max can be calculated by retime function like this
dailyMax = retime(TT,'daily','max');
dailyMin = retime(TT,'daily','min');
  댓글 수: 2
Erasmus Sowah
Erasmus Sowah 2018년 3월 20일
Ok, thank you boss, but my data length is 17520 because every 30 minutes in a day data is collected; so for a day 48 different values are obtained.
Akira Agata
Akira Agata 2018년 3월 21일
It's not clear for me what is the problem. The script can run even when the data length is 17520. Please try and see by changing the first line with this:
Time = (datetime(2017,1,1,0,0,0):minutes(30):datetime(2017,1,1,0,0,0)+minutes(30)*(17520-1))';

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by