By " I get stacked in for loop" do you mean "stuck", maybe?
And it is not at all clear what pause has to do with anything -- certainly if you enter a pause command, MATLAB will indeed "pause temporarily stops MATLAB® execution and waits for the user to press any key" so where you are would all depend on when such was issued.
That it would be random values each time is to be expected; there would be no way to synchronize that command timing with the time the loop began.
If instead you mean there's one file for which you don't ever satisfy the if condition; that would be purely data dependent -- that there simply isn't any value for that file that is True.
We could only verify that by having the data file...