app object not being passed to App GUI function, intermittently

30 次查看(过去 30 天)
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 个)

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by