issue opening old apps in appdesigner

30 views (last 30 days)
Jim Hokanson
Jim Hokanson on 13 Dec 2025 at 5:18
Commented: dpb on 14 Dec 2025 at 21:46
I have an app that I believe is from MATLAB 2020b. When I try to open it in appdesigner in MATLAB 2023 or 2024, I am getting the following error:
Error using matlab.ui.Figure/set
Functionality not supported with figures created
with the uifigure function.
Error in addToolbarExplorationButtons
It is not clear to me which line is throwing this error. Is there an "update" program that can be run to fix this? If I open the code in an older version of MATLAB appdesigner, such that I can edit the code, is there a function call that I can change that will fix this?
Here's the set function (I think), although it is unclear why this is an error. I am pretty sure I can make the same call in newer versions of MATLAB without an issue.
function createComponents(app)
% Create figure and hide until all components are created
app.figure = uifigure('Visible', 'off');
app.figure.Position = [100 100 598 624];
app.figure.Name = 'MATLAB App';
where the app.figure is set as follows:
properties (Access = public)
figure matlab.ui.Figure
which I believe is what is causing the set call.
Oops, update ....
It seems that the appModel.mat file, which is in the mlapp has the figure creatFcn set, and basically calls: addToolbarExplorationButtons
It does not seem like the createFcn is exposed in the appdesigner (if I wanted to edit in an old MATLAB version). I also tried unzipping, editing appModel.mat my loading it into old MATLAB, overriding the creatFcn, and then saving to disk, rezipping the directory, and then changing the extension back to mlapp. However, when I do this I get that MATLAB is unable to open the app in appdesigner.
How do I "update" my app so that I can edit in newer versions of MATLAB?
  2 Comments
Image Analyst
Image Analyst on 14 Dec 2025 at 0:29
Edited: Image Analyst on 14 Dec 2025 at 0:31
I always think of .mat files as basically data files where you store variables, not as executable code that actually runs code and calls functions. Can you explain exactly how your mat file is actually calling the functions creatFcn(), set(), and addToolbarExplorationButtons()? Does that happen automatically somehow when you call load('appModel.mat')???
If you attach your .mat file and your .mlapp file, we can run it and possibly fix it.
You said you can run it in newer versions so why do you want to run it an old version from 2023 or 2024?
Jim Hokanson
Jim Hokanson on 14 Dec 2025 at 5:17
Thanks for the comments. Yes, Mathworks advertises that mat files are not necessarily safe and loading them can execute code. https://www.mathworks.com/help/matlab/ref/load.html (see the "security consideration" section)
Here's an example:
f = uifigure();
f.CreateFcn = @(~,~)disp('fig loaded');
save('temp.mat','f')
close(f)
load('temp.mat');
That will run the create function on loading the mat file.
I was not able to get the app running in newer versions of MATLAB (at least initially, see below). Sorry for the confusion. I was saying the uifigure code that is visible, runs just fine. Thus it was unclear what the error was. The issue of course, was that apparently the app had embedded a call to addToolbarExplorationButtons in the uifgure createFcn, which I can't see in the appdesigner (only indirectly through the error, and directly in the mat file, which of course is "hidden")
I eventually defined a variable addToolbarExplorationButtons that was a function handle (and basically did nothing) and managed to load the app in a newer version of MATLAB (at least on my mac, I think I tried something similar in Windows and was having problems). In reality I'm not sure exactly what change was made, or how exactly it was fixed. I may have also done this:
Really I'd like a clear fix that I felt good about, thus asking the question.
Also just to be complete, I'm loading with 2023 or 2024 versions just because I'm slow to update MATLAB. I am assuming I would have the same issue with 2025, I just haven't tested it yet.

Sign in to comment.

Answers (1)

dpb
dpb on 13 Dec 2025 at 15:07
Moved: dpb on 13 Dec 2025 at 16:11
I think you need to submit an official support request to Mathworks because, as your later posting notes, the internal functions are protected by AppDesigner and you can't mung on them outside it and be able to then open them again in the environment.
AppDesigner is supposed to be able to open any prior app; the only transition tool is the one for prior GUIDE-based apps that isn't applicable here.
  2 Comments
Jim Hokanson
Jim Hokanson on 14 Dec 2025 at 4:45
Edited: Jim Hokanson on 14 Dec 2025 at 14:55
Thanks. I'l reach out. I'm surprised this isn't a bigger issue since I was just using the defaults. I would think anyone updating from an older version of MATLAB to a new version would run into this. I thought for sure I'd be able to edit the internals, even if making a misstep meant breaking everything. I'm still not convinced that I didn't screw something up when editing the variables in the mat file, although part of me suspects some sort of hash is in place to check if the zip file has been tampered with.
Edit: Being surprised this is not affecting more people, I remembered that many years ago I had this code in my startup, which explains why I am having this issue. Oops!
set(groot,'defaultFigureCreateFcn',@(fig,~)addToolbarExplorationButtons(fig))
set(groot, 'defaultAxesCreateFcn', @(ax,~) disableDefaultInteractivity(ax))
dpb
dpb on 14 Dec 2025 at 21:46
Yeah, anytime you do make any customizations, it's easy to forget having done so...

Sign in to comment.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!