×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

basic for most i'm sure...

basic for most i'm sure...

basic for most i'm sure...

(OP)
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 smile

RE: basic for most i'm sure...

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources