Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

basic for most i'm sure...

Status
Not open for further replies.

justMoi

Bioengineer
Joined
Apr 26, 2007
Messages
1
Location
CA
First off, I'm a complete Newbie to Matlab, so please be gentle (quiver...!)

I have an m file script that I want to run every 10 seconds. I managed to figure that bit out using the timer function. i.e.

t = timer('TimerFcn','plotTest','StartDelay',10);
start (t)

This script is part of the function itself,
i.e. 'plotTest', so the the thing just loops and loops ad infinitum. Great!

But how to I stop this? CTL + C is ugly, especially as you have to catch it when executing. I have a feeling it is somthing to do with stopFcn and callbacks (duh ??) but can't penetrate Matlab's arcane help files.

Any help in simplest English for a non-programmer's brain would be much, much, much appreciated.

Thanks,
Laura :-)
 
I haven't personally used the timer function before, but my first impression would be that you could control your looping better with a 'for' or 'while' loop and then use timer or 'wait' inside the loop. I don't know what criteria you are using to decide to stop the looping, or I would suggest which of 'for' or 'while'.

Nick Scheidler

Postdoctoral researcher
Microcirculation laboratory
Bioengineering department
University of California, San Diego
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top