error message in app designer when closing app

Hello,
I have made an App that works ok hwoever when I close my app (made in app designer), I get the following error message in the Matlab Command screen:
Invalid or deleted object.
Error in Trade_App_1/startupFcn (line 27)
app.Label_1.Text = Label_L;
Error using matlab.apps.internal.GraphicsCallbackProxy/runCallbackFunction (line 23)
Error while evaluating GraphicsCallbackProxy CallbackFcn.
Can any one help? Thx in advance
Thx
Leon

댓글 수: 4

Jan
Jan 2022년 6월 20일
Why does the startup function run during closing the dialog?
@Leon - at what point (or under what circumstances) does this line
app.Label_1.Text = Label_L;
execute? Do you (for example) have a timer that updates this text every x seconds? Please clarify.
Leon
Leon 2022년 6월 20일
Hello Geoff
I have an infinity loop in which I update the label with the data from another function
while 1
xxxxxxx
end
And as I mentioned it only happens when I close the app.
BR
Leon
Leon
Leon 2022년 6월 20일
Sorry the answer is of course for both Jan and Geoff

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

 채택된 답변

Geoff Hayes
Geoff Hayes 2022년 6월 20일

0 개 추천

@Leon - rather than using a while loop to update your label (which I suspect is the cause of the error), I recommend using a timer instead to do the work that is in the body of the while loop. You would then start the timer and then later stop the timer as the app exits. This should prevent the error from occurring.

댓글 수: 3

Leon
Leon 2022년 6월 20일
Thx for your answer Geoff,
One question. If I use a timer, it could be that while the program is calculating (which might take some time talking about max minutes) the timer will keep updating the data (and also the label as the lable shows the data) and the data is also used for the calculation. So it could be the timer is all the time updating the data and the calculation never gets finished?
Can I pause the timer, or something like that?
BR
Leon
@Leon - I guess it all depends upon what your current while loop is doing. Is it calculating some result and then updating the label on the UI? Can one iteration of the timer take minutes to calculate? You can stopt the timer and restart it but there doesn't seem to be any pause or resume capability. Can you provide more details about what happens in the body of your while loop?
Leon
Leon 2022년 6월 20일
Thx for you answer Geoff, I will first work with to see if I can solve it. If not I will come back to you.
BR
Leon

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

릴리스

R2020b

질문:

2022년 6월 20일

댓글:

2022년 6월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by