Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
timer function

Subject: timer function

From: Jehad Zughyer

Date: 10 Oct, 2008 02:58:03

Message: 1 of 3

I am following the Matlab help about timer function and excuting the follwing lines:

t = timer('StartDelay',10,'TimerFcn','disp(''Hello World!'')', 'Period', 10,'TasksToExecute',2);
start(t)

When I excute the above lines, I get : Hello World . and it stops. I believe it is suppose to repeat it twice!
Is my understanding wrong? or I got a bug in my Matlab version? (6.5 student version, Matlab is not busy with other functions when I excute the line).
Thanks

Subject: timer function

From: Donn Shull

Date: 10 Oct, 2008 03:19:02

Message: 2 of 3

if you check the timer with the command get(t) you will probably find that the ExecutionMode is singleShot so it will only trigger once. You can use

set(t, 'ExecutionMode', 'fixedRate');

then you will get what you are looking for.

Donn

"Jehad Zughyer" <zjehad@yahoo.com> wrote in message <gcmgbq$7sd$1@fred.mathworks.com>...
> I am following the Matlab help about timer function and excuting the follwing lines:
>
> t = timer('StartDelay',10,'TimerFcn','disp(''Hello World!'')', 'Period', 10,'TasksToExecute',2);
> start(t)
>
> When I excute the above lines, I get : Hello World . and it stops. I believe it is suppose to repeat it twice!
> Is my understanding wrong? or I got a bug in my Matlab version? (6.5 student version, Matlab is not busy with other functions when I excute the line).
> Thanks

Subject: timer function

From: Jehad Zughyer

Date: 10 Oct, 2008 14:40:19

Message: 3 of 3

Donn,
You are a gem. It worked. Thanks
"Donn Shull" <donn.shull.no_spam@aetoolbox.com> wrote in message <gcmhj6$gij$1@fred.mathworks.com>...
> if you check the timer with the command get(t) you will probably find that the ExecutionMode is singleShot so it will only trigger once. You can use
>
> set(t, 'ExecutionMode', 'fixedRate');
>
> then you will get what you are looking for.
>
> Donn
>
> "Jehad Zughyer" <zjehad@yahoo.com> wrote in message <gcmgbq$7sd$1@fred.mathworks.com>...
> > I am following the Matlab help about timer function and excuting the follwing lines:
> >
> > t = timer('StartDelay',10,'TimerFcn','disp(''Hello World!'')', 'Period', 10,'TasksToExecute',2);
> > start(t)
> >
> > When I excute the above lines, I get : Hello World . and it stops. I believe it is suppose to repeat it twice!
> > Is my understanding wrong? or I got a bug in my Matlab version? (6.5 student version, Matlab is not busy with other functions when I excute the line).
> > Thanks

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us