First you find the maximum value, then you will find all the elements equal to it:
m = max(myArray); maxIndex = find(myArray == m);
Or using variable names:
maxChaqueCell = [4 5 5 4]; maximum = max(maxChaqueCell) indicesDesMax = find( maxChaqueCell == maximum );
Here's how you find them, not just the first one.
source share