MATLAB Answers

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

3 ビュー (過去 30 日間)
Joydeb Saha
Joydeb Saha 2021 年 7 月 27 日
回答済み: KSSV 2021 年 7 月 27 日
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

Community Treasure Hunt

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

Start Hunting!

Translated by