accumulate in multiple array
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Kafayat Olayinka
am 17 Mai 2019
Kommentiert: Kafayat Olayinka
am 17 Mai 2019
I have:
Temperature profiles array for 5 days. such that, temp(heigth,day). however, there are multiple profile in some days which makes the number of profile equal 11.
size of temp = (3650 by 11)
size of day = (1 by 11)
day=[1,1,1,2,2,3,3,3,4,4,5].
I want to:
average temperature for every similar days
such that:
dailyday=[1,2,3,4,5]
temp=(3650 by 5)
0 Kommentare
Akzeptierte Antwort
madhan ravi
am 17 Mai 2019
splitapply(@(x) mean(x,2),Temp,findgroups(Day))
5 Kommentare
madhan ravi
am 17 Mai 2019
Bearbeitet: madhan ravi
am 17 Mai 2019
C=splitapply(@(x) {mean(x,2)},Temp,findgroups(Day));
[C{:}]
%or
[~,~,c]=unique(Day);
C = accumarray(c,1:size(Temp,2),[],@(x){mean(Temp(:,x),2)});
[C{:}]
Weitere Antworten (1)
Walter Roberson
am 17 Mai 2019
[mean(temp(:,1:3),2), mean(temp(:,4:5)), mean(temp(:,6:8)), mean(temp(:,9:10)), temp(:,11)]
Siehe auch
Kategorien
Mehr zu Graphics Performance 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!