how to get reference in app designer

5 ビュー (過去 30 日間)
Luca Re
Luca Re 2023 年 12 月 5 日
編集済み: Matt J 2024 年 4 月 27 日
i'm in Predator_Equity.Mlapp and i create Lista_strategieAggreg using:
Lista_stratzegieAggreg(app);
it's possible to receive referenze of this app?
example: xx=Lista_stratzegieAggreg(app);
but it doesn't run
Why do I need it? because when I create Lista_strategie Aggreg I want to update a value in the panel (where there is the red arrow in the photo I have to update the text box) and to do so I need the reference
  3 件のコメント
Ehab
Ehab 2024 年 4 月 27 日
編集済み: Matt J 2024 年 4 月 27 日
app.t = readtable("book9.xlsx","Sheet",1);
app.UITable.Data = app.t;
j = app.idEditField_2.Value;
data.id{1} = 1111;
data.id{2} = 222;
data.id{3} = 333;
i= j;
for i=(1:3);
app.t.name(1);
app.t.id(2);
app.t.salary(3) ;
app.t.age(4);
end
app.nameEditField_2.Value{j} = 'name';
app.salaryEditField_2.Value{j} = 'salary';
app.ageEditField_2.Value{j} = 'age';
Voss
Voss 2024 年 4 月 27 日

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

採用された回答

Matt J
Matt J 2023 年 12 月 5 日
編集済み: Matt J 2023 年 12 月 5 日
It is possible, and what you've shown should have worked, unless your Matlab version is really old.
The Code view should show the calling and output syntax of the app constructor function, e.g.,

その他の回答 (1 件)

Gloria Beard
Gloria Beard 2023 年 12 月 5 日
編集済み: Voss 2023 年 12 月 5 日
Selecting the Component in App Designer: Open your App Designer project. In the App Designer, select the component or control you want to get a reference to. This could be a button, text box, plot, etc.
Naming the Component: In the "Properties" pane on the right side of the App Designer, there is an option called "Name." Assign a unique name to the component. This name will be used to reference the component in your code.
Accessing the Component in Code: In the App Designer, click on the "Code View" button or select the "View Code" option from the "View" menu. This will take you to the MATLAB code editor for your app.
Using the Reference in Code: Once you are in the code editor, you can use the reference to your component by its assigned name. For example, if younamed a button 'myButton', you can reference it in your code like this:
% Accessing the button's properties
myButton.BackgroundColor = [1, 0, 0]; % Set background color to red
% Adding a callback function to the button
myButton.ButtonPushedFcn = @(src, event) myButtonCallback(src, event); <spam link removed>

カテゴリ

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