フィルターのクリア

Figure createfcn in app designer

5 ビュー (過去 30 日間)
Adee
Adee 2021 年 12 月 2 日
回答済み: Adee 2021 年 12 月 2 日
I have an app that always creates an empty figure when I load it into appdesigner. It is quite annoying.
I realized after some debugging that it is caused by the createfcn property of the top figure, which has been set to a function that caused the window to open. When I deleted the function I got an error. The biggest problem is, I could not find any way to access the createfcn field from appdesigner.
The value of createfcn seems to have resulted from setting the default figure createfcn to a non-empty value when the app was created... After that point, it is saved in the app with no apparent way to change it.
To reproduce this problem, do something like
set(groot, 'defaultfigurecreatefcn', 'disp Hello')
and then create an app in appdesigner.
I suspect the same issue can happen with any of the default settings, especially createfcn's of various objects, that are not exposed in appdesigner.
I have an awkward workaround that I'll post as an answer, but any other suggestions are welcome.

回答 (1 件)

Adee
Adee 2021 年 12 月 2 日
An awkward way to remove the figure createfcn:
  1. Place a breakpoint in %MATLABPATH%\toolbox\matlab\appdesigner\appdesigner\+appdesigner\+internal\+serialization\FileReader.m, after the line "appData = load(tempFileLocation);" (That is the line that causes the createfcn to run).
  2. Load the app into appdesigner
  3. When the breakpoint is hit, Enter appData.components.UIFigure.CreateFcn='' ;
  4. Continue with loading the app
  5. Use "Save as" to save the app with another name
The app with the new name should have no figure createfcn.

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by