views:

919

answers:

1

I have a MATLAB GUI and a separate application that writes data to a file. I'd like my MATLAB GUI to check the file periodically, and update the GUI when it changes.

In Java, I'd use a SwingUtils.Timer(sp?) object to do something like this. Does MATLAB have timer functionality? I could write a java class and do it I suppose, but want something quick and dirty for a demo, preferably pure MATLAB.

+5  A: 

You can create timer objects in MATLAB using the TIMER function. For example, this creates a timer object which should execute the function myFcn once every 10 seconds after the timer is started:

timerObject = timer('TimerFcn',@myFcn,'ExecutionMode','fixedRate',...
                    'Period',10.0);

Timers are started and stopped using the functions START and STOP. You should also always remember to delete them with DELETE when you're done using them. You can find more info on using timers in the MATLAB documentation.

gnovice