Error: The logical indices contain a true value outside of the array bounds.

조회 수: 1 (최근 30일)
The assignment is to calculate the mean of 1 month in the year 2019. The function seems logical to me and other students, but I keep getting errors. Can someone help?
Maand=month
Jaar=year
function Tgem2 = MaandGem2019(maand19)
load data_weer.mat
b=TG(jaar==2019);
for d=1:length(b)
c(d)=mean(b(maand==maand19))
end
Tgem2=c
  댓글 수: 2
Stephen23
Stephen23 2020년 1월 16일
@Bram van der Horst: please upload your data to your question by clicking on the paperclip button.
Stephen23
Stephen23 2020년 1월 16일
Bram van der Horst's "Answer" moved here:
Uploaded.

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

채택된 답변

David Hill
David Hill 2020년 1월 16일
function Tgem2 = MaandGem2019(maand19)
load data_weer.mat;
Tgem2=mean(TG(jaar==2019&maand==maand19));
end

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by