MATLAB: Is there a way to execute multiple functions in Matlab at a specific time ??

executiontimer objects

For example I want to execute function one every 15 sec, function two every 40 sec and so on. I've tried to use timer object, but without any success.
function main
function one ();
disp('1')
end
function two ()
disp('2')
end
function three ();
disp('3')
end
end

Best Answer

For example, for your first function:
>> fun = @(~,~)disp('1');
>> t = timer('TimerFcn',fun, 'Period',15, 'ExecutionMode','fixedRate');
>> start(t)
... displays every fifteen seconds
>> stop(t)
>> delete(t)
Do the same for the other functions:
t1 = timer(...)
t2 = timer(...)
...
start(t1)
start(t2)
... whatever happens here
stop(t1)
stop(t2)
...
delete(t1)
delete(t2)
...
You could even put the timer objects into one array and use loops to perform those operations.