Need help with simple loop

1 Ansicht (letzte 30 Tage)
Joost de Witte
Joost de Witte am 9 Okt. 2019
Beantwortet: Walter Roberson am 9 Okt. 2019
I've got a matrix of 35040x14 (35040x 15minutes). I now want to to get the maximum value per hour over these 14 colomns. I've made the following for the first hour:
myData = 35040x14
oneHour = myData(1:4,:);
maxValuePerHour = max(oneHour);
oneHour gives me a 4x14 matrix which I then took the maximum per column from resulting in a maxValuePerHour matrix of 1x14, as intended. However, I want to loop this process so I end up with a 8760x14 (35040/4) where in the 8760 rows represent maximum values per hour for the entire data set.
Any help would be appreciated. Thank you.

Antworten (1)

Walter Roberson
Walter Roberson am 9 Okt. 2019
squeeze( min( reshape(myData, 4, [], size(myData,2)), 1) )

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by