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

조회 수: 39 (최근 30일)
Yerlan Cheldybayev
Yerlan Cheldybayev 2020년 11월 19일
편집: Muhammad 2023년 6월 21일
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
Mario Malic
Mario Malic 2020년 11월 19일
You'll have to contact the customer service to fix this.
Muhammad
Muhammad 2023년 6월 21일
편집: Muhammad 2023년 6월 21일
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

댓글을 달려면 로그인하십시오.

채택된 답변

Benjamin Kraus
Benjamin Kraus 2020년 11월 19일
편집: Benjamin Kraus 2020년 11월 19일
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
Zeyu Shi
Zeyu Shi 2021년 3월 16일
@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 2021년 3월 16일
@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).

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by