Yes true exactly what I mean I have tried this also but I get erroneous output like if 7.885,7.2,7.7225 I get 7.225 as maximum value while 7.885 is the maximum.i also wrote explicit code for finding maximum I assigned all entropy values to array then tried to find max using both max() as well as code for max value in array inside loop but both gives same result.
The loop to calculate entropy for each image should be like Mohammad's code above. He construct a matrix E to store the entropy value (but for your code, E is a constant). After that, using max(max(E)) will be ok.