App Designer unwanted figure opening on initial run?

Hi - this is my first app Designer app... Sometime after a few weeks of development, each time I start my mlapp, an empty figure pops up. I looked through the code using search and I don't have anywhere in the startup function specifiying a figure (or UIfigure). I can't find any call in my code for the unwanted figure. I moved my mlapp file over to a collegue's computer (we have a site license). If I open on his system, no figure pops up??? Sorry this is quite vague without seeing the code, but it almost seems like my app designer somehow got a default "open a non-UI figure" somewhere in settings? It can't be part of the mlapp if it doesn't spawn on antoher computer, correct? Any idea where I can find a setting for the mlapp designer which would request a non-UI figure during initial run??? Thanks in advance. Sorry, this is a very minor inconvenience, but it's now become an obsession to find!

6 Comments

Is it possible that It is opening on the other computer, but closes rapidly so you don't see it? Perhaps the other computer is faster or something?
Is it when you start matlab or each time you run your app?
I suspect that you have a stray gca or gcf or hold call, possibly in a startup file
How can we find the culprit when you forgot to attach the .mlapp file? Please attach it with the paperclip icon.
What happens if you step through the startup code from the very beginning line-by-line? You should be able to find the line of code that creates the figure that way.
Thanks all for the rapid feedback. The "other" computer is far slower - and the figure is persistent. It does "show up" after the main UI is created on the desktop. Walter - it only creates the figure (Figure 1) when I run the app - and only on my computer. ImageA - I will post the startup function here. My sponsor probably wouldn't want me posting any more than that... I put a breakpoint on the starup function and stepped through - no spurious figure created. That's why I thought perhaps there are some settings associated with the mlapp file that I can't find? It's a minor annoyance as I said, just seems like there should be a call somewhere to that figure?
function startupFcn(app)
[app.CompoundT,Compounds] = GetCompounds();
Compounds_new{1} = 'Any';
Compounds_new = [Compounds_new; Compounds];
app.CompoundDropDown.Items = Compounds_new;
app.SelectCompoundDropDown.Items = Compounds_new;
[app.SampleT, Indexes] = getIDs();
Indexes_new{1} = 'All';
Indexes_new = [Indexes_new; Indexes];
app.SelectSampleDropDown.Items = Indexes_new;
app.SelectionFlag = 0;
warning('off');
% Create the global variable
app.OrdinationDataSet = [];
% set the precision Changed to null
app.changePrecision = 0;
dbstop if error;
end
I do have several properties that are supposed to be app-wide handles to figures created by the app user. That would likely be a question for later, but the figure handles do not persist (e.g. app.FigureType1 = figure('Name', 'Fig1'); called within a function doesn't persists. If I later code: close(app.FigureType1); it causes an exception - app.FigureType1 doesn't exist). I don't think that should matter in the properties, because you don't have to specify the type - and I have 4 different figures - so if that were the issue, I'd think there would be 4 figures created when I started the app. And why only on one computer???
Thanks again all!
That does sound like a puzzle given your debugging efforts seem to be thwarted, my suggestion would be to start commenting out code until the behavior changes, that should rule out your code as an explanation beyond what you've already done. Or start with a blank app and incrementally add the code.
Is the other computer running an identical version of Matlab?
you might also try using findall https://www.mathworks.com/help/matlab/ref/findall.html, put that in your code and see if it can detect your phantom figure.
I completely understand how this would be extremely annoying and why you've become obsessed with fixing it. I would do the same.
Ah - thanks for the tip. Will try that. As I mented below my code (separate issue, so, I know I'm supposed to post in a separate question. But perhaps it's related?) I do use findall within my mlapp to gather up figures to close. I'll try that routine at the end of the startupFnc and see perhaps if it shows up. I did try putting in a pause and it just delayed the UI and the spurious figure... It's very bizzare to me... A minor annoyance for sure but hard to let go!

Sign in to comment.

Answers (1)

I figured this out... Embarrased to post this, but our work site license allows home use and I wanted to try the arduino toolbox. I have two versions and I - well - I noticed I hit the taksbar icon for the home version. That appears to be it. Home version - figure popup, License server version - no pop up. The home version has a warning but because the license server version has issues with my VPN, work permission and the path, there's always a string of orange warning text (my brain is on ignore, which might indicate more significant senilty problems) ... I removed the home version icon from my quick launch, so should no longer be an issue... Careless! Sorry to post for something (in retrospect) so obvious!

Categories

Find more on Develop Apps Programmatically in Help Center and File Exchange

Products

Release

R2021a

Asked:

on 16 Jan 2022

Answered:

on 26 Jan 2022

Community Treasure Hunt

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

Start Hunting!