MATLAB Answers

To find Maximum value and minimum value for each group of four rows for a 180*1 matrix

3 views (last 30 days)
Joydeb Saha
Joydeb Saha on 27 Jul 2021
Answered: KSSV on 27 Jul 2021
Say I have a 180x1 matrix. I have to find the max and min value of each 12 rows. e.g, max min value of 1-12th row and 13th to 24th row and so on..

Accepted Answer

More Answers (1)

Rik
Rik on 27 Jul 2021
Easy if you reshape the vector to an array:
data=rand(180,1);
data_=reshape(data,12,[]);
max(data_,[],1)
ans = 1×15
0.9353 0.9149 0.8658 0.9909 0.9962 0.9774 0.9912 0.9617 0.9288 0.8957 0.9471 0.8812 0.9200 0.8054 0.8691
min(data_,[],1)
ans = 1×15
0.0552 0.0024 0.0409 0.0265 0.0392 0.0085 0.0041 0.0097 0.2144 0.0208 0.0942 0.1048 0.1427 0.0291 0.0015

Community Treasure Hunt

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

Start Hunting!