Plotting a graph in app designer using simulink

6 ビュー (過去 30 日間)
Vojin Veskovic
Vojin Veskovic 2022 年 8 月 30 日
コメント済み: Vojin Veskovic 2022 年 9 月 9 日
I have problem to plot a easiest graph in app designer. In simulink i made simple model of sinWave as input, and 'to workspace' named 'Sin' as output, in design view i have 2 Edit Fields, UIAxes and Button. I found on the solution on internet, but doesn't work when i try it. Here is my sintax in app designer: Assignin('base','U',app.EditField.Value); simout = sim('exmpl','StopTime', num2str(app.durationEditField.Value)); Plot(app.UIAxes,simout.Sin.Time,simout.Sin.Data); What can be a problem? I realy don't understand why it doesn't work.

採用された回答

Sabereh
Sabereh 2022 年 9 月 7 日
Use 'output' instead of 'to workspace'.
function startupFcn(app)
h = load_system('test');
%test
end
% Button pushed function: runButton
function runButtonPushed(app, event)
simout = sim('test');
assignin("base","simout",simout);
plot(app.UIAxes,simout.tout,simout.yout{1}.Values.Data);
end
end
Here is the result:
  3 件のコメント
Sabereh
Sabereh 2022 年 9 月 7 日
In different versions of MATLAB, the name yout may be different. Send simout to work space using assignin and then check the exact name of your data.
Vojin Veskovic
Vojin Veskovic 2022 年 9 月 9 日
Thank you again on your answer, it was very helpful tu me. Atribute actualy is named yout and was empty matric, and now i figured out why, but it steel doesn't work. I will probably find out what is problem, after your help all the time.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by