I have a GUI in which I create and start a bunch of timers during the startupFcn. Frequently I get the following error:
Error while evaluating TimerFcn for timer 'statusUpdateTimer'
Trying to load file "<filename>.mlapp" while it is being loaded.
It seems to happen more frequently if the timer is started at the end of the constructor, but I've also seen it at other times (ie not just during construction) on timer callbacks when other GUI operations are running.
What does the error mean and how can I eliminate it?

댓글 수: 5

Adam Danz
Adam Danz 2020년 9월 30일
What does the TimerFcn do? It sounds like there may be some recursion.
Do all of the timers have the same TimerFcn? Perhaps placing a pause(t) between the timer functions would help but that's a shot in the dark without knowing what those functions do.
Paul Murrin
Paul Murrin 2020년 9월 30일
편집: Paul Murrin 2020년 9월 30일
The TimerFcn is a method of the GUI class. It mostly sets properties of GUI objects such as static text, lamp colours etc, based on the values of various properties.
The callback method is defined as:
function statusTimerFcn(app,~,~)
And this is passed to the timer setup as:
app.statusTimer = timer(...
'TimerFcn', @app.statusTimerFcn);
There is no direct recursion as far as I'm aware. Also the different timers have different callbacks.
Adam Danz
Adam Danz 2020년 9월 30일
Can you identify which function is causing the error?
Please share the entire error message including the caller stack if available.
Paul Murrin
Paul Murrin 2020년 9월 30일
That is the entire error message. I can't trap it so can't obtain a call stack.
I've managed to eliminate it in this instance by adding a startDelay which is longer than the app startup interval. It is a complex GUI app so takes several seconds to initialise. I guess the object is not fully ready when the timer first fires.
I've been grappling with the same error in various forms for a while and I am usually able to mitigate it but never get at the root cause and don't really understand what is going wrong.
Adam Danz
Adam Danz 2020년 9월 30일
Usually errors that occur within AppDesigner indicate where the error is happening and this is an important bit of info. I had a feeling the timer fcn doing something too early within the initialization of the app. Sounds like you solved it with the start delay.

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

릴리스

R2019b

태그

질문:

2020년 9월 30일

댓글:

2020년 9월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by