MATLAB: Task scheduling

runrun configurationtask schedulertimerfcn

Hello everybody!
I have a problem with executing a script in Task Scheduler. A script needs to execute itself in the background(daily). I found several tutorials but it just doesn't seem to work. I can't configure it right. Tried this…
It runs Matlab, I've tried, but I also want it to open a script and run it. Something to do with -r as in the link above. Afterwards it would be great if it could exit the program.
Are there any other solutions? Since MatLab will always stay open, can I just specify time when it should run a particular script? I've tried TimerFcn, but as I understand it won't run scripts? Or does it?
Thank you!
I use Windows 7.

Best Answer

You can use this call to start the function "YourFcn", wait for 10 seconds and close Matlab afterwards:
matlab -r "YourFcn; pause(10); exit"
This call can be used in Window's Task Schedular.
Another idea would be to add the exit to the function.
The TimerFcn can run scripts. Simply insert the script name as String as the TimerFcn. But I bet, Matlab will not stay open all the time. The Task Schedular of the operating system is more reliable.