Say that I have the following matrix in MATLAB:
I=[2 1;4 5];
How can I retrieve the position of the largest element??
You can do as follows:
[value, location] = max(I(:));
[row,col] = ind2sub(size(I), location);
>> [row, col]
ans =
2 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With