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

4 vues (au cours des 30 derniers jours)
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..

Réponse acceptée

KSSV
KSSV le 27 Juil 2021
A = rand(180,1) ;
B = reshape(A,12,[])' ;
themax = max(B) ;
themin = min(B) ;

Plus de réponses (1)

Rik
Rik le 27 Juil 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

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by