Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Take the nanmean of every four points in a dataset.

조회 수: 1 (최근 30일)
Rebecca Ellis
Rebecca Ellis 2018년 12월 5일
마감: MATLAB Answer Bot 2021년 8월 20일
I have a data set of 109 points, each point repesents 15min. I need to get hourly averages of this data set which also contains nans as well as the time attached with it. Any help would be much appreciated.
%% so far:
st_time=datenum('23-May-2017 09:15:00');
t=st_time+(0:1/27.25):(length(East)-1)*1/27.25);
ADV_time_avg=st_time+(0:1/227.25):(length(East)-1)*1/27.25);
Flux4 = Flux3;
means5 = nanmean(Flux4, 2);
for i = 1:length(Flux4)
hourav(i) = nanmean
end

답변 (1개)

per isakson
per isakson 2018년 12월 5일
편집: per isakson 2018년 12월 5일
"I need to get hourly averages of this [15-min] data set which also contains nans"
Old time approach
%%
data_set = randn(109,1); % sample data
%%
data_set(end) = []; % multiple of 4
%%
m4 = reshape( data_set, 4,[] );
%%
avg = nanmean( m4, 1 );
%%
hourly_data_set = reshape( avg, [],1 );
However, I assume that using timetable is a better approach.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by