필터 지우기
필터 지우기

Run a function in given time moments.

조회 수: 4 (최근 30일)
Valeriy
Valeriy 2023년 11월 5일
이동: Dyuman Joshi 2023년 11월 7일
Hi all
I need to run MyFunction.m tomorrow starting from 14:20:00 and repeat it 10 times with periodicity of 5 minutes. How to proceed?
Thanks for help

채택된 답변

Walter Roberson
Walter Roberson 2023년 11월 5일
MATLAB does not support that.
The closest to that is that timer supports a start delay -- so you could calculate the time difference between now and 14:20 tomorrow and use that as the delay. But that is going to not going to start exactly on time -- and if you exit MATLAB in the meantime then the timer will not run, and will not start up again if you go back into MATLAB.
  댓글 수: 3
Walter Roberson
Walter Roberson 2023년 11월 5일
I would suggest writing a control table to a file indicating the date/time when each event is to start.
Then, periodically:
  1. read the file
  2. schedule a timer object (using relative time) for any event that is due to start within the next two refresh cycles; if there is already a timer for the event, check to see whether the start time delay needs to be updated
This scheduling should also be done upon starting MATLAB
Creation of a new event should be accompanied by writing the event to the control file and then running the check cycle again.
Valeriy
Valeriy 2023년 11월 7일
이동: Dyuman Joshi 2023년 11월 7일
@Walter Roberson and @Dyuman Joshi, thank a lot for your ideas and proposals. Now it is clearer for me how to realize this task, appreciate your help

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by