put a program on standby

조회 수: 6 (최근 30일)
Ahsan Khan
Ahsan Khan 2011년 12월 9일
hi there,
is there a way i can start a program at a certain time. for example i want a part of a program to start a certain time of the day and then stop at a certain time. so im assuming the program will be in "standby mode" until that specific time accurs. any help would be greatly appreciated. thanks alot. cheers SN

채택된 답변

Daniel Shub
Daniel Shub 2011년 12월 9일
You might be better off an OS level scheduler (for example cron in Linux and task scheduler in Windows). You can have the OS scheduler launch a new instance of MATALB with the -r flag pointing to the function/script you want to run.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 12월 9일
To start a program at a certain time of day, you could use a timer set to go off then.
To avoid having to run everything in the context of the timer callback, you could create a graphics object (anything; set it non-visible if you want), then create the timer with a callback that will delete that object, then have the routine waitfor() that object. The routine will sit there, and when the timer eventually goes off the timer will delete the object, which will terminate the waitfor() and allow the routine to continue.
  댓글 수: 1
Jan
Jan 2011년 12월 9일
If you create an invisible GUI, care for avoiding "clear all" and "close all" commands in your code.
A command like
system('powercfg /S "High System Performance"')
can help you to disable the sleep-timers of your operating system, if you use Windows.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Big Data Processing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by