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

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2015년 6월 28일
편집: Azzi Abdelmalek 2015년 6월 28일

0 개 추천

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

Lilya
Lilya 2015년 6월 28일
pardon Mr. Azzi can you give me more explanation thank
Azzi Abdelmalek
Azzi Abdelmalek 2015년 6월 28일
Run the code line by line, and see the result of each line; you will understand
Lilya
Lilya 2015년 6월 28일
ok thank you there is one thing please if I want plot the new matrix with the predicted I just only take (a) corresponding to pred matrix?

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Measurements and Feature Extraction에 대해 자세히 알아보기

태그

질문:

2015년 6월 28일

댓글:

2015년 6월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by