どうすれば、appdesignerのバックグラウンドでSimulinkを実行できますか?
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
appdesignerで作成したアプリの画面上で、例えば"計算"ボタンを押すと、ボタンに対応したSimulinkモデルがバックグラウンドで実行され、計算結果がアプリの画面に表示される、というような事をしたいです。
サンプル「sf_fitness」がイメージに近いのですが、どのように実現されているかが分かりませんでした。 ご教授頂けると幸いです。
なお、使用しているバージョンはR2017bです。
0 Commenti
Risposta accettata
Tohru Kikawada
il 18 Feb 2018
モデルを開いてStateflowチャートの UI Controller を開いてみてください。
初期化ルーチンでApp Designerで作ったGUIを起動していることが分かります。
INIT
% Initialize Appdesigner app and import the App's interface.
en:
coder.extrinsic('sf_fitness_app', 'updateBeat', 'detectedActivity', 'updateSteps', 'updateClock', 'updateHeartRate', 'updateText');
app = sf_fitness_app();
さらに対応するApp DesignerのGUIを開くと、Simulinkモデルに値を反映している箇所を見つけられます。
>> edit sf_fitness_app
startupFcn を見てみると set_param でSimulinkのパラメータを変更してますね。
% Code that executes after component creation
function startupFcn(app)
% Get initial time from clock time
app.startTime = clock;
% Set initial states for the model
set_param('sf_fitness/Stop', 'Value', '0');
set_param('sf_fitness/Human_Simulator/Activity', 'Value', 'ActivityType.Rest');
set_param('sf_fitness/Human_Simulator/Strength', 'Value', '1');
app.Slider.Enable = 'off';
app.Button_Msg.BackgroundColor = [0.20, 0.80, 0.20]; %green
app.UIFigure.Name = 'SF_FITNESS';
app.Button_Msg.Icon = '';
app.Text_Step.Value = sprintf(' %d', 0);
pause(0.1);
app.UIFigure.Resize = 'off';
end
Più risposte (0)
Vedere anche
Categorie
Scopri di più su 対話型のモデル編集 in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!