MATLAB: Calling a value in a matrix

calling a variablematlab function

I have two sets
X Y
1 2
3 6
4 7
5 8
I have to find highest value in category Y which is 8, after finding that 8 is the highest value I have to call value 5 in category X to from a matrix [ 5 8].
I know how to find the largest value, but I don’t know how to call 5 from X category.
Please can someone help me in call the specified value.

Best Answer

Let 's try
X = [1 3 4 5];
Y = [2 6 7 8];
[max_val, idx] = max(Y);
X_idx = X(idx);