Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock 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
Apr 26, 2007
1
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 :)
 
Replies continue below

Recommended for you

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