ワークスペース上の変​数をAppDesig​nerでプロットする

MATLABワークスペースから、AppDesigerへの変数の受け渡し方法がわかりません。
例えば下記のような変数x,yがMATLABのワークスペース上に定義されているとします。
x=1:10;
y=sin(x);
このAppDesigerでグラフをプロットするにはどのようにすれば良いでしょうか?

 Akzeptierte Antwort

Kojiro Saito
Kojiro Saito am 28 Mai 2020

2 Stimmen

evalinコマンドでワークスペースから変数を取ってくればできます。
座標軸を(app.UIAxes)をApp Designerの設計ビューに置いて、
以下のようなコマンドをアプリのstartupFcnやボタンのコールバックに入れてみてください。
x = evalin('base','x');
y = evalin('base','y');
plot(app.UIAxes, x, y)

Weitere Antworten (0)

Kategorien

Mehr zu App Designer を使用したアプリ開発 finden Sie in Hilfe-Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!