how to calculating hourly average?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi all, I have an observed (obs) data those were tooke every 6 min and the predicted (pred) data were recorded every 1 hr I want to take the average hour to calculate the residusl (r) by taking an obs. every 10 values corresponding to 1 value in the pred. those are also including NaN values (obs)
anyone can help me I will approciate it
thank you
0 件のコメント
採用された回答
Azzi Abdelmalek
2015 年 6 月 28 日
編集済み: Azzi Abdelmalek
2015 年 6 月 28 日
v=randi(9,1,55) % Example
n=ceil(numel(v)/10)*10
v(end+1:n)=nan
a=reshape(v,10,[])
idx=~isnan(a)
for k=1:size(a,2)
out(k)=sum(a(idx(:,k),k))/sum(idx(:,k))
end
Or
v=randi(9,1,55) % Example
n=ceil(numel(v)/10)*10
v(end+1:n)=nan
a=reshape(v,10,[])
out=nanmean(a)
3 件のコメント
Azzi Abdelmalek
2015 年 6 月 28 日
Run the code line by line, and see the result of each line; you will understand
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Time Series についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!