Want to convert hourly Data into Daily Mean
    2 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    Bikiran Das
 il 19 Lug 2016
  
    
    
    
    
    Commentato: Bikiran Das
 il 20 Lug 2016
            My Data Has hourly recording from date 27th March 2013 to 30 Jan 2015 the Data for 28th March 2013 to 29th Jan 2015 has data for every hour and i.e. daily records are 24 in numbers where as for 27th of March 2013 the data is recorded from 06:00:00 HRS to 23:00:00 Hrs and similarly for 30th Jan 2015 the recorded data is from 00:00:00 HRS to 05:00:00 HRS.
Please help me getting the daily average for the data with single date 1st column.
0 Commenti
Risposta accettata
  Azzi Abdelmalek
      
      
 il 19 Lug 2016
        %--------------Example----------------------------------
d=datenum('28-03-2013 07:00:00','dd-mm-yyyy HH:MM:SS'):1/24:datenum('30-01-2015 05:00:00','dd-mm-yyyy HH:MM:SS')  
M=[d' randi(10000,size(d'))]
%--------------------------The code--------------------
f=datevec(d)
g=f(:,1:3)
s,ii,jj]=unique(g,'rows')
v=accumarray(jj,(1:numel(jj))',[],@mean)
dates=datestr(d(ii))
out=[cellstr(datestr(d(ii)))  num2cell(v)]
5 Commenti
  Azzi Abdelmalek
      
      
 il 19 Lug 2016
				load DATA
load time
d=datenum(time)
M=[d  Data]
f=datevec(d)
g=f(:,1:3)
[s,ii,jj]=unique(g,'rows')
v=accumarray(jj,(1:numel(jj))',[],@(x) {nanmean(Data(x,:),1)});
dates=datestr(d(ii))
out=[cellstr(datestr(d(ii)))  num2cell(v)]
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Language Fundamentals in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!