Setting Access Properties to Public without AppDesigner

4 ビュー (過去 30 日間)
Jack Georege
Jack Georege 2021 年 4 月 22 日
コメント済み: Jack Georege 2021 年 4 月 27 日
So I'm working on a project that requires programmatic GUI development, and I'm trying to set a variable to public so it can be used and shared between multiple callback functions.
I'm essentially trying to make the:
properties (Access = public)
x = 1234
end
happen but obviously it does not work. Is there a way to set a variable to be shared between callback functions programmatically?
FYI; I'm using a uifigure based GUI so I can't use anything that only works on a figure based GUI.

採用された回答

Rik
Rik 2021 年 4 月 23 日
As you can see here, class properties are public by default, so you don't need to add any text. The rest of that thread might be interesting for you as well.
  2 件のコメント
Jack Georege
Jack Georege 2021 年 4 月 27 日
Well if that's the case, then why can't a variable edited in one callback function be referenced as the updated variable in another? When running the callback function after the variable becomes changed, it just references what the variable was upon the creation of the GUI.
Jack Georege
Jack Georege 2021 年 4 月 27 日
Nevermind actually. I figured it out by just creating another label underneath my panel to store the editable variables, meaning that it can access them anywhere even after the original are cleared. My project is a bit complex so that probably makes no sense, but it works and that's all that matters :D

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop uifigure-Based Apps についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by