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

46 visualizaciones (últimos 30 días)
Yerlan Cheldybayev
Yerlan Cheldybayev el 19 de Nov. de 2020
Editada: Muhammad el 21 de Jun. de 2023
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 'matlab.graphics.axis.Axes' " . But if double click on the *.mlapp file, it opens and works fine. How the problem might be fixed?
Thank you!
  4 comentarios
Mario Malic
Mario Malic el 19 de Nov. de 2020
You'll have to contact the customer service to fix this.
Muhammad
Muhammad el 21 de Jun. de 2023
Editada: Muhammad el 21 de Jun. de 2023
i have the problem when i want to open my .mlapp file it's says Error loading 'my.mlapp'. i don't know why. I am using MATLAB_R2022a

Iniciar sesión para comentar.

Respuesta aceptada

Benjamin Kraus
Benjamin Kraus el 19 de Nov. de 2020
Editada: Benjamin Kraus el 19 de Nov. de 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.
  8 comentarios
Zeyu Shi
Zeyu Shi el 16 de Mzo. de 2021
@Benjamin KrausThank you so much! The problem is resolved by this technique you offered. I've spent so much time on editing matlab variables that @Andrew Dahlberg mentioned (a lot thanks too). I think my problem was that I put disableDefaultInteractivity(app.UIAxes) in my startupFn. I don't have problem closing and reopening the app now but I also cannot reproduce the issue.
Benjamin Kraus
Benjamin Kraus el 16 de Mzo. de 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).

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by