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=6
x=[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}