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

3 次查看(过去 30 天)
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..

采纳的回答

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

更多回答(1 个)

Rik
Rik 2021-7-27
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

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by