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