SOLVED - Slip a single array in three unequal parts, three years observation with a leap year in between
    4 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    CARLOTTA DENTICO
 am 22 Jun. 2021
  
    
    
    
    
    Bearbeitet: Cris LaPierre
    
      
 am 23 Jun. 2021
            Hello everybody, 
I am very new to matlab and I need all your help: 
I have this array  26304 x 1 that are hourly observations of sst over three years: i need to split this array in three arrays corresponding to year 2014, 2015 and 2016. I can't split the array in equal parts since year 2016 is a leap year. 
I will then compute the monthly mean for each months in each year and merge the data together again, in order to have a single array 1096x1. 
Thank you very much! 
2 Kommentare
  Cris LaPierre
    
      
 am 22 Jun. 2021
				Not sure how monthly data for 3 years gives you 1096. Wouldn't 12 months x 3 years = 36 rows of data? Did you mean daily instead of monthly?
Akzeptierte Antwort
  Cris LaPierre
    
      
 am 22 Jun. 2021
        
      Bearbeitet: Cris LaPierre
    
      
 am 23 Jun. 2021
  
      I would look into timetables and groupsummary. With a timetable, you can add a date and time to each row, and then with groupsummary, you can group your data by year and month, and compute the mean of each group.
data = rand(26304,1);
dataTT = timetable(data,'TimeStep',hours(1),'StartTime',datetime(2014,1,1))
avgT = groupsummary(dataTT,"Time","month","mean")
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Dates and Time 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!

