How to get max/min temp data from hourly data?
Afficher commentaires plus anciens
Hi,
I have a dataset of hourly data for a 30+day period and have no clue where to start to get the daily min and max temperatures for each day of this period? Can anyone help me? Imagine that column1 is the day of year, column 2 is the time, and column 3 is the hourly temp.
Réponse acceptée
Plus de réponses (1)
JAG2024
le 29 Jan 2015
3 commentaires
Star Strider
le 29 Jan 2015
My pleasure!
The problem with for loops is that they’re inefficient, and aren’t the best option for large problems. The built-in functions are optimised, and in many instances use compiled C-code to do the requisite operations.
One way to generate my ‘Tv24’ matrix with a for loop is:
for k1 = 1:30
ofst = (k1-1)*24 + [1:24];
Tv24(:,k1) = Tv30(ofst);
end
There are likely other variations that would work as well.
Still another option uses the mat2cell function:
Tv24 = mat2cell(Tv30, repmat(24,1,30), 1);
Choose the one that is best for your application.
JAG2024
le 30 Jan 2015
Star Strider
le 30 Jan 2015
Again, my pleasure!
Catégories
En savoir plus sur Time Series Objects dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!