set variable in App Designer

25 ビュー (過去 30 日間)
TheDice
TheDice 2021 年 4 月 6 日
コメント済み: TheDice 2021 年 4 月 8 日
Hi i want to save the Value from a variable number of Field in a variable number of cache. I know hot to get the Value from a variable number of field but i dont know how to safe them.
app.Mat_Cache(v) = get(app.MatField(v),'Value');
  1 件のコメント
TheDice
TheDice 2021 年 4 月 8 日
Thank you so much. Sometimes it can be so easy but hard to find.

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

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 4 月 6 日
Variables in an app are considered properties. See the Share Data Within App Designer Apps for how to create the property and then use it in your app. You'll also see that you do not need to use get or set anymore.
  4 件のコメント
TheDice
TheDice 2021 年 4 月 8 日
When I write it like this: "app.Ausspg_Field(v).Value = 200;"
I get the following error: "Unable to perform assignment because dot indexing is not supported for variables of this type."
Cris LaPierre
Cris LaPierre 2021 年 4 月 8 日
I stand corrected. When you capture multiple objects in a matrix, that variable is no longer a graphics object, and you cannot access the value that way. You'll have to use set and get. Sorry for the confusion.
app.Mat_Cache(v) = get(app.MatField(v),'Value');
% or
set(app.MatField(v),'Value',200+v);

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop 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