MATLAB: How to take the maximum value of an array arraymax Hi, I have this array a = [1:20]. How do I take the maximum value of every 5 elements of it. So I will have b = [5 10 15 20]. Anyone can help me? Thank you. Best Answer This works:a = [1:20];b = max(reshape(a, 5, [])); Related SolutionsMATLAB: How to shade area of Integral I’m not quite certain what you want. This shades the area between the x-axis and the value of the integral over the interval (0,5):y = @(z) -1*z.^3+4*z.^2+-5*z+2;x = linspace(0, 5);inty = cumtrapz(x,y(x));figure(1)plot(x, inty, '-k', 'LineWidth',1)hold onpatch([x fliplr(x)], [zeros(size(x)) fliplr(inty)], 'g')hold offgrid MATLAB: Matrix reshaping reshape(A',1,[]) Related QuestionPlotting two vectors side by side.How to create plots for special areas of an arrayBars showing the measurement periods for oceanography dataHow to concatenate a row vertically every 5 cellsHow to build a for-loop for 3rd dimensional noise realizations
Best Answer