I'm surprised this even finished! You definitely don't want to call xlswrite 2592 times or it will take hours. Perhaps you opened up Excel to look at it after only a few of the calls to xlswrite had been executed.
You should create a 2D matrix for output and then put a single call to xlswrite after both "a" and "b" loops have finished.
Other problems: your (badly-named) x is just column 1 of Array every time. And you don't even need the loop over b because you can use the sum function: sum(x>newval) to count the number of pixels more than the half max value (which you chose the poor, non-descriptive name of newval for).