i want to get the max value from a column matrix from a specific no of rows ?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
OMKAR ACHARJEE
am 6 Jun. 2018
Kommentiert: OMKAR ACHARJEE
am 6 Jun. 2018
suppose i have a 269712x1 column matrix ,from the matrix i want to find the max value from each 8760 rows and in this way i have to get 1 value from each 8670 rows which are repeated 30 times. How do i proceed?
0 Kommentare
Akzeptierte Antwort
monika shivhare
am 6 Jun. 2018
Bearbeitet: monika shivhare
am 6 Jun. 2018
Let A is your given data column matrix, and m is matrix of maximums of each 8760 rows
m=zeros(30,1);
for i=1:30
m(i)=max(max(A((i-1)*8760 +1 : i*8760)));
end
We are using max(max()) because max(X) gives row of maximum value of each column. Alternatively, you can use
m=zeros(30,1);
A=A';
for i=1:30
m(i)=max(A((i-1)*8760 +1 : i*8760));
end
Weitere Antworten (1)
KSSV
am 6 Jun. 2018
A = rand( 269712,1) ; % some random data for demo
% discard extra elements
idx = round(length(A)/8670)*8670 ;
A = A(1:idx) ;
B = reshape(A,8670,[]) ;
iwant = max(B)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!