Delete uiprogress object at the end of startup function
Afficher commentaires plus anciens
Hello,
It seems that MATLAB is not deleting the uiprogress object variable when startup function in App Designer apps ends execution.
- Does it behave differently for some local variables? I do now delete or close (pBar), but why bother when it is local variable?
function startupFcn(app)
pBar = Utility.showIndeterminateBar(app.UIFigure);
%.....
end
%... Still runs....
UPDATE 1
I tested a separate app, and it the correct behaviour operated but not with actual. Though I have tested it with above code, removed the Utility function so that you can test...though there is nothing...
UPDATE 2
Tested with onCleanup, the result is the same...I can conclude that this has to do with MATLAB not clearing the startupFcn on time/immediately...The question would be; is there anything that can be done to prevent this?
function onCleanUpTask = showIndeterminateBar(uifigObj)
uiprogbar = uiprogressdlg(uifigObj,'Title','Please Wait...',"Indeterminate","on");
onCleanUpTask = onCleanup(@()delete(uiprogbar));
end
For your full knowledge I do have:
app.onCleanupArray{1} = onCleanup(@()cleanUpTasks(ParamNumberIn));
ParamNumberIn is a param variable local to startupFcn which will be deleted when the UIFigure is deleted. Which maybe the cause that MATLAB is saving the WORKSPACE for that function because this referenced local variable?
6 commentaires
Adam Danz
le 14 Avr 2020
Just a shot in the dark, but what if you execute this at the end of the startupFcn?
delete(pBar)
Bereketab Gulai
le 14 Avr 2020
Adam Danz
le 14 Avr 2020
What is this and where did it come from?
Utility.showIndeterminateBar
Bereketab Gulai
le 14 Avr 2020
I assumed that the progress bar you're describing is produced in Utility.showIndeterminateBar (based on the variable name and that it's called from the startupFcn) but I don't know what that function is.
AppDesigner doesn't show a progress bar when opening the app unless you've programmed one, so the source of the progress bar is unclear.
When opening the app for editing, a progress bar is shown (example below). Is this was you're referring to?

Bereketab Gulai
le 14 Avr 2020
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Develop Apps Using App Designer dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!