Why do I need to divide by 12 in the second line to make it equal to line 1?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Nesha Wright
am 4 Jul. 2018
Kommentiert: Image Analyst
am 6 Jul. 2018
year_avg = mean(sum(sum(sum(dl,1),2),3),4);
year_avg= mean(sum(dl(:)))/12;
4 Kommentare
Basil C.
am 4 Jul. 2018
If I'm not wrong you don't need to use mean because the output of
(sum(sum(sum(dl,1),2),3),4) and
sum(dl(:))
is a single number and not a vector.
Akzeptierte Antwort
Image Analyst
am 4 Jul. 2018
dl is a 4-D array. Think of it as a 3-D volumetric chunk of data, and there are 12 of them, like 12 blocks.
Now, what exactly do you want to do with those 12 blocks?
Average each block so that you have 12 averages - an average over all elements in each block?
Or an average over all possible elements over all 12 blocks so that you have only one average? If so, try this:
year_avg = mean(dl(:));
7 Kommentare
Image Analyst
am 6 Jul. 2018
And you can't read it in and save just a few years worth of data in a new .mat file??? OK, whatever. Failing having some data to work with all I can say is that the code should work.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Time Series Events finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!