필터 지우기
필터 지우기

Matlab timer doesnt work in stand alone application

조회 수: 1 (최근 30일)
E
E 2016년 5월 19일
답변: Image Analyst 2016년 5월 22일
Hi Guys,
i have built this application that listens to a certain folder and continuously checks if certain files appear in it. once these files appear i activate another function to process them. I implemented the folder listener using a Timer object with a fixed rate of 30 sec. (i.e - every 30 sec it should check the content of the folder.) Everything works great when i run the code from within Matlab, yet when i compile and then deploy the app the timer only executes once and then exits the program.
any idea what can cause this difference between compiled and un-compiled versions?
system is Ubuntu 14.04,
timer object instance:
myTimer = timer('TimerFcn',@checkFolderForChanges,'Period',h.listenerInterval,'ExecutionMode','fixedSpacing','BusyMode','queue','UserData',userData);
compile arguments:
mcc -mv fileWatch.m
debug lines i added to monitor the timer, from within Maltab:
timer running mode: on
timer tasksExecuted mode: 682
timer running mode: on
timer tasksExecuted mode: 683
stand alone deployed version (exits after 1 timer task execution:
timer running mode: on
timer tasksExecuted mode: 1
vncuser@mathlab:~/visualizer$

채택된 답변

Walter Roberson
Walter Roberson 2016년 5월 19일
  댓글 수: 3
Walter Roberson
Walter Roberson 2016년 5월 21일
The behavior is not really different. You have to imagine there being a "quit" statement after the last line of a compiled executable. Once it has done its work, it is not going to hang around. The way it knows it has finished is that it reaches the end of the code.
Walter Roberson
Walter Roberson 2016년 5월 21일
uiwait() is a convenience wrapper around waitfor(), which applies to objects and to changes in properties, not just graphics.

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

추가 답변 (1개)

Image Analyst
Image Analyst 2016년 5월 22일
I'm not sure why your program doesn't work. I have programs that are compiled and use a timer to poll pushbutton switches, and they work fine.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by