How to get max/min temp data from hourly data?
Mostra commenti meno recenti
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.
Risposta accettata
Più risposte (1)
JAG2024
il 29 Gen 2015
3 Commenti
Star Strider
il 29 Gen 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
il 30 Gen 2015
Star Strider
il 30 Gen 2015
Again, my pleasure!
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!