Error: The logical indices contain a true value outside of the array bounds.
1 回表示 (過去 30 日間)
古いコメントを表示
Bram van der Horst
2020 年 1 月 16 日
コメント済み: Bram van der Horst
2020 年 1 月 16 日
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
2020 年 1 月 16 日
@Bram van der Horst: please upload your data to your question by clicking on the paperclip button.
採用された回答
David Hill
2020 年 1 月 16 日
function Tgem2 = MaandGem2019(maand19)
load data_weer.mat;
Tgem2=mean(TG(jaar==2019&maand==maand19));
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!