Plots graph from simulink scope to App Designer for MATLAB R2019a

I have an error using evalin command to plot simulink scope in UI axes - app designer MATLAB R2019a. How to solve this?

Answers (2)

Hi Nur,
I am not sure what the error is, but you can look at a similar query here:
Hope it helps!

6 Comments

Thank you. I have opened the link but did not solved my problem.
The code below I have generate in MATLAB R2009b and the graph display in GUI;
switch popupmenu1value
case 'PLOT 1'
simout = evalin('base','simout');
axes(handles.VVaxes1)
plot(simout.Time,simout.Data(:,1),'r','LineWidth',2)
xlabel('')
ylabel('Voltage[V]')
but, when I generate the code in 2019a the graph did not display and error in app designer. I have to use MATLAB R2019a for supporting Arduino Nano 3.0 board.
Actually, I have tried this code below but still did not display the graph and error in app designer;
switch app.PLOTSOPTIONSDropDown.Value
case 'LIVE PLOTS'
out = evalin('base',Output);
app.PLOTSOPTIONSDropDown.Value = 'LIVE PLOTS';
app.UIAxes_1
plot(app.UIAxes_1,evalin('base',out.Output.Time),evalin('base',out.Output.Data(:,1)),'c','LineWidth',2)
Hey,
Can you provide the error message that you received?
I have attached .pdf for the error message. Hopefully you have the solution for my problems. Thank you.
Hi again!
I don't think the problem is with the 'evalin' function. For some reason, the variable 'Output' is not recognized i.e it is not in the workspace you are working in. Can you make sure you have it in your workspace and check if the error persists? Also which block are you using for 'Output' in the model?
hi
Solution to your question see here
https://se.mathworks.com/matlabcentral/fileexchange/73613-interface-between-matlab-app-and-simulink?s_tid=answers_rc2-1_p4_Topic

Sign in to comment.

Starting in R2024a, you can use App Designer to interactively create an app for a Simulink model, which includes the capability to easily and performantly visualize signal data in the app using the new time scope UI component.
In addition, you can:
  • Add UI components configured specifically to interact with your model, such as a simulation start/stop control and a simulation progress bar.
  • Tune model variables from the app while the simulation runs by connecting UI components to variables.
For more information, see Create App for Simulink Model.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Asked:

on 8 Nov 2019

Answered:

on 26 Apr 2024

Community Treasure Hunt

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

Start Hunting!