App designer (Matlab 2020b) does not open *.mlapp file

38 views (last 30 days)
I have created an app in matlab 2020b app designer and currently it is not possible to open it in app designer. The error message is: " Unrecognized method, property, or field 'DesignTimeproperties' for class '' " . But if double click on the *.mlapp file, it opens and works fine. How the problem might be fixed?
Thank you!
Mario Malic
Mario Malic on 19 Nov 2020
You'll have to contact the customer service to fix this.

Sign in to comment.

Accepted Answer

Benjamin Kraus
Benjamin Kraus on 19 Nov 2020
Edited: Benjamin Kraus on 19 Nov 2020
I've attached a fixed version of your app (app2fixed.mlapp).
The problem with the app was that one of the UIAxes stored in the app had the CreateFcn set to disableDefaultInteractivity(gca). This is a bad idea, and I'll get to that in a moment.
As the app is saving, the call to gca is creating a regular axes (not UIAxes), which was being added to your app and saved along with your app. Then, when you loaded the app, the additional regular axes was confusing the loading process.
I deleted the extra axes, and removed the CreateFcn from the UIAxes, and resaved the app for you.
The root of the problem (I suspect) is that you have set the DefaultAxesCreateFcn in MATLAB set to be 'disableDefaultInteractivity(gca)' which is not recommended and is going to cause lots of other problems.
The issue is the call to gca, which will only work if the axes has HandleVisibility set to 'on' and if the parent figure of the axes also has HandleVisibility set to 'on'. Otherwise, gca will create a new axes instead of operating on the axes you think it should. In App Designer, the figure has HandleVisibility set to 'off' by default.
The better way to achieve the same goal is to use a function handle and set the DefaultAxesCreateFcn like this:
set(groot, 'defaultAxesCreateFcn', @(ax,~) disableDefaultInteractivity(ax))
The difference here is that the axes handle itself is passed directly to disableDefaultInteractivity so it is no longer dependent upon gca working.
Benjamin Kraus
Benjamin Kraus on 16 Mar 2021
@Zeyu Shi: I'm happy to hear that your problem is resolved.
As far as I know, this problem only arrises when you call disableDefaultInteractivity(gca), using gca instead of passing in your UIAxes handle.
It should be safe to put disableDefaultInteractivity(app.UIAxes) into your startupFcn. If this caused trouble for you, and you can reproduce the issue, please report the problem to MathWorks Technical Support (reference this conversation).

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by