A couple of suggestions:
0, check the time spent on different lines by running this script with smaller limits on j and i with the profiler running.
1, cut out the disp(i) and disp(j) entirely. In your version you'll have matlab printing some 8.4*10^11 numbers to the command-window. There's no way that your screen-pixels will survive that. (perhaps put something like:
in to see that it turns over. You can modify the divisor to get more or less frequent updates
2, put the '\n' into the first fprintf call - should/might speed things up.
3, combine all conditions into one if-test, they are supposed to shortcut as soon as the TRUE/FALSE is determined - this might speed up or slow down, but ought to be worth a test.
4, instead of calling cell2mat in every fprintf-call do that separately first for all cells in y to create an array of strings, this might speed things up a bit.