Maximum Number of UIAxes in App Designer 2017b
Show older comments
Hi!
I recently have been tasked with building a large GUI in Matlab App Designer. After finally finishing placing all the UI elements, I notice that my plotting functions no longer work when calling them. The figures that these plotting functions relate to are also not visible, but still contained in the GUI object. There are no errors reported for this, but rather the GUI refuses to update those plots. The rest of the data is visible on other tabs and the GUI is still functional.
After a bit of searching on other issues related to this, I found this post: https://www.mathworks.com/matlabcentral/answers/327311-why-do-app-designer-uiaxes-elements-start-to-disappear?s_tid=answers_rc1-2_p2_MLT which mentions a limit of 16 axes that was supposed to be fixed for 2017a. The GUI has well over 100 UIAxes in the app currently, so I'm wondering if there is a new limit within MATLAB.
Thanks!
EDIT: I have attached an error that showed up probably 20 minutes after clicking the plot menu action.
2 Comments
Chris Portal
on 6 Dec 2018
What kind of graphics card does your machine have? (Some cards have an inherent limit on the nuber of graphics contexts that can be created.) You can query this by:
>> opengl info
Chas Frick
on 6 Dec 2018
Answers (1)
Andy
on 6 Dec 2018
0 votes
MATLAB got past the old limit (which was imposed by the technology used) by falling back to a different way to create graphics contexts. However, some graphics cards have limits on how many graphics contexts they can make. You may be running into a limit from that. The error log you attached (thanks!) shows the problem was in the fallback graphics creation.
You may be able to avoid the first limit (and thus avoid the fallback which may be hitting the other limit) by putting your UIAxes into different uifigures. Can you group them into different figures?
How many UIAxes are you getting successfully? Or if they don't work, do all stop working?
I'm also interested in the info Chris requested above.
thanks
andy
7 Comments
Andy
on 6 Dec 2018
Sorry, I mean to make that a comment on the question rather than an answer, at least until we helped you get past the problem.
andy
Chas Frick
on 6 Dec 2018
Andy
on 7 Dec 2018
Your graphics driver is a little old. I don't know if there is a specific problem with it, but maybe updating would help.
It should be that after your first 16, you should still be able to make more axes but they will be generated in a different way. (You shouldn't be able to tell the difference usually.) If you aren't getting more than 16 at all, I'd try updating the driver, and then contacting support.
Are you able to make regular figures with graphics on the same system? In other words, can you do plot(peaks) (for example) in MATLAB and see the picture?
As far as creating multiple figures, I see this:
I'm more of a graphics guy than an app designer guy, so am not sure, and I think that looks a bit more involved than what you'd want.
In R2018b, you can put subplot in an app designer figure if you turn off AutoResizeChildren. Multiple axes in a subplot all use a single graphics context.
f = app.UIFigure;
f.AutoResizeChildren = 'off';
a = subplot(2,2,1, 'Parent', f);
plot(a,peaks)
a = subplot(2,2,2, 'Parent', f);
plot(a, magic(5))
a = subplot(2,2,3, 'Parent', f);
plot(a, 1:10)
a = subplot(2,2,4, 'Parent', f);
plot(a, rand(1,20))
Does that help?
andy
Chas Frick
on 7 Dec 2018
Andy
on 7 Dec 2018
The specific behavior is that when you go over the limit of graphics contexts, it removes the oldest of the contexts. That's why you are seeing the 16 final views. I think your card seems to be having a limit on graphics contexts, and maybe it is showing 18 or 20 before it gives up.
How many separate regular figures can you make?
for i = 1:n
f = figure; axes(f)
end
Can you do the above (from MATLAB command window, not app) with n = 30?
The behavior of an axes for Visible = 'off' is to make the axes decorations themselves (axles, ticks, labels) invisible. The contents remain visible. I was going to look up whether the tabs have a visible property, but I'm not sure how that would interact with the behavior of tabs, showing one at a time. Seems like it ought to do the trick.
Thanks for updating your driver, and I'm glad it helped a bit. I suggest you contact support and tell them about this page, and how many figures you can make at once (like the loop I show above). I am not positive we'll be able to solve it, but I at least want to see if there is a difference between how many axes you can show in an app vs how many you can draw normally.
andy
Chas Frick
on 10 Dec 2018
Chas Frick
on 18 Dec 2018
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

