
Plotting a graph in app designer using simulink
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Vojin Veskovic
el 30 de Ag. de 2022
Comentada: Vojin Veskovic
el 9 de Sept. de 2022
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.
0 comentarios
Respuesta aceptada
Sabereh
el 7 de Sept. de 2022
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 comentarios
Sabereh
el 7 de Sept. de 2022
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.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!