MATLAB: To find Maximum value and minimum value for each group of four rows for a 1576*1024 matrix

matrix arraymatrix manipulationsignal processing

Hello Researchers!!
I need guidance, as i have a matrix H1 of 1576*1024, which is vertical concatination of four channels, in H1 for continuous four rows it represent one frame of each channel, i need to find maximum and minmum value for every four group of rows. untill now i just get to find maximum and minimum value for each row.
kindly guide me, how can i apply 2nd loop or design function, so that i can get results for each four group of rows, and in total i will have 394 results.
H1 = vertcat(A,B,C,D)
temp_A = zeros(1576,2);
for N = 1:1:1576
temp_A(N,1) = max(H1(N,:));
temp_A(N,2) = min(H1(N,:));

Best Answer

  • Hello,
    Please try below soluition.
    naMax = [];
    naMin = [];
    for i = 1:4:size(H1,1) % H1 is your original matrix
    naMax = [naMax, max(max(H1(i:i+3, :)))]; % append values

    naMin = [naMin, min(min(H1(i:i+3, :)))];% append values
    % You can transpose if necessary