anonymous
anonymous

Reputation: 439

is there any possibility to directly start a function with a timer

In the matlab documentation, there it says that for TimerFcn

"Character vector, function handle, or cell array defining the timer callback function. You must define this property before you can start the timer.

If you specify this property using a character vector, when MATLAB executes the callback it evaluates the MATLAB code contained in the character vector."

Now, i have written a function called Schallquelle and I would it to be started periodically. Since the code that I would like to be evaluated is just calling a function, I called the function. So what I'm trying to do is the following:

t=timer('ExecutionMode', 'fixedRate', 'Period', 3,...
    'TasksToExecute', 10, 'StartDelay', 3 );
t.TimerFcn='Schallquelle([0 0], 5)';

But it does not work.Actually if I run my script, nothing happens. What am I doing wrong?

Upvotes: 0

Views: 40

Answers (1)

Suever
Suever

Reputation: 65430

You have to actually start the timer for the function to be executed since it's only executed when the timer is running.

start(t)

Upvotes: 2

Related Questions