You could create a while ... end loop for your routine where the condition evaluated involves comparing time to absolute or elapsed time.
There is a timer available in matlab the documentation explains how to implement one:
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!