one simple altenative i can give is use a property in your app. for example add this to properties:
properties (Access = public)
flag
when you want to start the loop make shore the value is 1 (or True) and in your while loop use this :
while app.flag
%%
end
in pausebutton pushed function use this :
function pausebuttonPushed(app, event)
app.flag = 0;
end
that will do it.
if you want the press buttom command rapidly apply to loop and pause it (skip other updates in query of app) use this in the while loop:
while app.flag
%%
drawnow update;
end