MATLAB: How to find maximum before a certain element in the matrix maximum of certain elements in matrix For example B=[5 8 5 2 6 9 10] min(B)=2 I am looking for maximum point before min(B), which is 8 (not maximum of B elements, which is 10) Best Answer B=[5 8 5 2 6 9 10] ; [~,ind] = min(B); maxB4min = max(B(1:ind)) =8 Related SolutionsMATLAB: Trim Matrix and find the min-max value the reshaped matrix a=A(:,1:2:end)| b=A(:,2:2:end) [ii1,jj1]=min(a) [ii2,jj2]=max(a) [xx1,yy1]=min(b) [xx2,yy2]=max(b) MATLAB: How to set the same color scheme for two different plots Use caxis to set a fixed color scalepcolor(f)caxis([0,200])colorbar figurepcolor(b)caxis([0,200])colorbarYou can determine the min and max of the color scale dynamically withcaxis([min(fmin, bmin) max(fmax,bmax)]) Related QuestionHow to display in one variable the max of each one of two arraysHow to find maximum or minimum element in a matrixMax/Min of nonzero rows/cols
Best Answer