app object not being passed to App GUI function, intermittently

조회 수: 30 (최근 30일)
Corey
Corey 2025년 9월 10일 14:35
편집: Corey 2025년 9월 11일 15:49
In my App code, I am creating a timer object with a callback function.
The timer looks something like this:
app.tenMinuteTimer = timer('ExecutionMode', 'fixedRate', 'Period', 600, 'TimerFcn', @(~,~)app.createNewLogFile())
start(app.tenMinuteTimer);
The callback looks something like this:
function createNewLogFile(app)
try
% Explicit null checks
if isempty(app) || ~isvalid(app)
error('WARNING: App object is invalid in createNewLogFile context');
end
...
I am seeing the error message intermittently with this code, but only intermittently (about ~5% of the time over long durations of running the App). I would really like to understand what could be causing this to happen intermittently, how to confirm a root cause, and/or how to do this in a more robust way altogether.
I believe that memory issues can be ruled out, or any other issues relating to long-duration testing. I can observe this problem within a relatively short test. I suspect it may have to do with task scheduling on the host running the App, since the App is doing multiple things.
Heavy apologies for editing this post multiple times.. I will not change it again from now.
  댓글 수: 2
dpb
dpb 2025년 9월 11일 15:18
Looks like your addition of new info removed some prior background? I think need more context for anybody who didn't see the original to be able to get on the moving train...
If this is something that can be run without requiring some specific piece of hardware, I'd suggest creating a minimum example that can reproduce the problem and submit this to Mathworks as an official support request at <Product Support Page>
Corey
Corey 2025년 9월 11일 15:40
Yes sorry, I did have to edit it once because I learned new information. I will edit it one last time to make it coherent and have all relevant information.
Thank you for your suggestion - wise idea.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Target Computer Setup에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by