MATLAB: How to find maximum or minimum element in a matrix matrix example a=5 b=8 c=2 d=6 x=[a b c d] how to find minimum or maximum element of matrix x? the answer i want is its variable not its value. so the answer here is b and not 8 Best Answer a=5;b=8;c=2;d=6x=[a b c d];y={'a','b','c','d'};[c1,idx1]=max(x);[c2,idx2]=min(x);max_x=y{idx1}minx_x=y{idx2} Related SolutionsMATLAB: Min/Max with string match criteria [tf, idx] = ismember(Y, X); %not X, Y!minZ = accumarray(idx(:), Z, [], @min);maxZ = accumarray(idx(:), Z, [], @max); MATLAB: Find indices in accumarray syntax function idx = maxidx(x) [~, idx] = max(x);function idx = minidx(x) [~, idx] = min(x);Together with accumarray(OrbNO,elev,[],@(x) maxidx(x)-minidx(x), 0); Related QuestionHow to find maximum before a certain element in the matrixSubscript indices must either be real positive integers or logicalsHow to get the value and index of the point where the plot ends (Marked by an arrow in image below) and display it? I have used ‘find’ command but it did not help. Please help me out. .mat file is attached.Trim Matrix and find the min-max value the reshaped matrixHow to obtain max value form Matrix A B C , and write to Matrix DHow to find the row wise maximum and minimum values of equal sized matrices in a cell array
Best Answer