How to call a script when clicking on a button in matlab app.designer?

12 ビュー (過去 30 日間)
ErikJon Pérez Mardaras
ErikJon Pérez Mardaras 2021 年 1 月 14 日
コメント済み: Cris LaPierre 2021 年 1 月 14 日
I am trying to do the following app:
In which, when clicking on the button, a script is executed and its numerical calculations performed and its result appears in the white window
I have defined as private property the following variables with those values.
So when the button is clicked, the script (which name is: operasion.m) is called and the result (j) appears on the white window
The script is the following
Thank you very much for the help. By the way, the script.m and the app are saved in the same folder

採用された回答

Cris LaPierre
Cris LaPierre 2021 年 1 月 14 日
You run a script by calling it by name.
However, is there a reason you don't just include the code and parameters inside your app? It seems unnecessary to have this code in an external m file.
app.solu.Value= app.a + app.b;
  8 件のコメント
ErikJon Pérez Mardaras
ErikJon Pérez Mardaras 2021 年 1 月 14 日
編集済み: ErikJon Pérez Mardaras 2021 年 1 月 14 日
I have also to rename j as follows:
j=app.j;
And yes, It worked!
Thank you very much!!
Cris LaPierre
Cris LaPierre 2021 年 1 月 14 日
At least based on the original example you don't have to do j=app.j since j is calculated in the script. If you want to save the value in your app, you probably want to do the opposite.
app.j = j;

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by